targetj 1.0.233 → 1.0.234

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/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # TargetJS: State as Destination, Code Order as UI Sequence
2
2
 
3
+ ### Most frameworks are great at rendering state. TargetJS is designed for the journey between states.
4
+
3
5
  **[targetjs.io](https://targetjs.io)**
4
6
  [![MIT LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/livetrails/targetjs/blob/main/LICENSE)
5
7
  [![Stars](https://img.shields.io/github/stars/livetrails/targetjs.svg)](https://github.com/livetrails/targetjs/stargazers)
6
8
  [![npm version](https://img.shields.io/npm/v/targetj.svg)](https://www.npmjs.com/package/targetj)
7
9
 
8
- Most frameworks are great at rendering the next state. TargetJS is designed for the journey between states.
9
-
10
- TargetJS is a JavaScript UI framework that replaces the "State → Render" model with "State → transition → Render". It also lets code order directly define the UI sequence. It unifies UI, animations, API calls, event handling, and state into self-contained "Targets" that stack together like intelligent Lego pieces using Code-Ordered Reactivity.
10
+ TargetJS is a JavaScript UI framework that replaces the "State → Render" model with "State → Transition → Render". It also lets code order directly define the UI sequence. It unifies UI, animations, API calls, event handling, and state into self-contained "Targets" that stack together like intelligent Lego pieces using Code-Ordered Reactivity.
11
11
 
12
12
  It can be used as a full-featured framework or as a lightweight library alongside other frameworks. It is also a highly performant web framework, as shown in the [framework benchmark](https://krausest.github.io/js-framework-benchmark/current.html).
13
13
 
@@ -51,6 +51,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
51
51
  this.resumePausedList = [];
52
52
  this.resumePausedMap = {};
53
53
  this.resumeScheduled = false;
54
+ this.calcEpoch = 0;
54
55
  }
55
56
  return _createClass(LocationManager, [{
56
57
  key: "clear",
@@ -91,6 +92,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
91
92
  value: function () {
92
93
  var _calculateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
93
94
  var budgetMs,
95
+ calcEpoch,
94
96
  stack,
95
97
  ctx,
96
98
  _args = arguments;
@@ -98,42 +100,49 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
98
100
  while (1) switch (_context.prev = _context.next) {
99
101
  case 0:
100
102
  budgetMs = _args.length > 0 && _args[0] !== undefined ? _args[0] : 8;
103
+ calcEpoch = this.calcEpoch;
101
104
  if (!this.calcBusy) {
102
- _context.next = 4;
105
+ _context.next = 5;
103
106
  break;
104
107
  }
105
108
  this.calcQueued = true;
106
109
  return _context.abrupt("return");
107
- case 4:
110
+ case 5:
108
111
  this.calcBusy = true;
109
112
  this.hasLocationList.length = 0;
110
113
  this.hasLocationMap = {};
111
114
  this.locationListStats = [];
112
- stack = [];
113
- stack.push({
115
+ stack = [{
114
116
  container: (0, _App.tRoot)(),
115
117
  stage: 'init',
116
118
  children: [],
117
119
  viewport: undefined,
118
120
  index: 0
119
- });
121
+ }];
120
122
  ctx = {
121
123
  budgetMs: budgetMs,
122
- sliceStart: _TUtil.TUtil.now()
124
+ sliceStart: _TUtil.TUtil.now(),
125
+ calcEpoch: calcEpoch
123
126
  };
124
127
  _context.next = 13;
125
128
  return this.processStack(stack, ctx);
126
129
  case 13:
130
+ if (!(ctx.calcEpoch !== this.calcEpoch)) {
131
+ _context.next = 15;
132
+ break;
133
+ }
134
+ return _context.abrupt("return");
135
+ case 15:
127
136
  this.processAfterStack();
128
137
  this.scheduleResumePaused();
129
138
  this.calcBusy = false;
130
139
  if (!this.calcQueued) {
131
- _context.next = 19;
140
+ _context.next = 21;
132
141
  break;
133
142
  }
134
143
  this.calcQueued = false;
135
144
  return _context.abrupt("return", this.calculateAll(budgetMs));
136
- case 19:
145
+ case 21:
137
146
  case "end":
138
147
  return _context.stop();
139
148
  }
@@ -144,6 +153,13 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
144
153
  }
145
154
  return calculateAll;
146
155
  }()
156
+ }, {
157
+ key: "cancelCurrentCalculation",
158
+ value: function cancelCurrentCalculation() {
159
+ this.calcEpoch++;
160
+ this.calcBusy = false;
161
+ this.calcQueued = false;
162
+ }
147
163
  }, {
148
164
  key: "processStack",
149
165
  value: function () {
@@ -294,19 +310,31 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
294
310
  };
295
311
  case 4:
296
312
  if (!stack.length) {
297
- _context2.next = 21;
313
+ _context2.next = 25;
314
+ break;
315
+ }
316
+ if (!(ctx.calcEpoch !== this.calcEpoch)) {
317
+ _context2.next = 7;
298
318
  break;
299
319
  }
320
+ return _context2.abrupt("return");
321
+ case 7:
300
322
  if (!(_TUtil.TUtil.now() - ctx.sliceStart > ctx.budgetMs)) {
301
- _context2.next = 10;
323
+ _context2.next = 14;
302
324
  break;
303
325
  }
304
- _context2.next = 8;
326
+ _context2.next = 10;
305
327
  return new Promise(requestAnimationFrame);
306
- case 8:
328
+ case 10:
329
+ if (!(ctx.calcEpoch !== this.calcEpoch)) {
330
+ _context2.next = 12;
331
+ break;
332
+ }
333
+ return _context2.abrupt("return");
334
+ case 12:
307
335
  ctx.sliceStart = _TUtil.TUtil.now();
308
336
  return _context2.abrupt("continue", 4);
309
- case 10:
337
+ case 14:
310
338
  job = stack[stack.length - 1];
311
339
  if (job.stage === 'init') {
312
340
  container = job.container;
@@ -333,19 +361,19 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
333
361
  processAfterChild(job);
334
362
  }
335
363
  if (!(job.index >= job.children.length)) {
336
- _context2.next = 18;
364
+ _context2.next = 22;
337
365
  break;
338
366
  }
339
367
  processAfterAllChildren(job);
340
368
  stack.pop();
341
369
  return _context2.abrupt("continue", 4);
342
- case 18:
370
+ case 22:
343
371
  if (job.stage === 'child') {
344
372
  processChild(job);
345
373
  }
346
374
  _context2.next = 4;
347
375
  break;
348
- case 21:
376
+ case 25:
349
377
  case "end":
350
378
  return _context2.stop();
351
379
  }
@@ -57,19 +57,28 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
57
57
  key: "openPage",
58
58
  value: function () {
59
59
  var _openPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(link) {
60
- var visibles, newVisibles;
60
+ var shouldReset,
61
+ visibles,
62
+ newVisibles,
63
+ _args = arguments;
61
64
  return _regeneratorRuntime().wrap(function _callee$(_context) {
62
65
  while (1) switch (_context.prev = _context.next) {
63
66
  case 0:
64
- _context.next = 2;
65
- return _App.tApp.stop();
66
- case 2:
67
+ shouldReset = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
68
+ if (!shouldReset) {
69
+ _context.next = 7;
70
+ break;
71
+ }
67
72
  _context.next = 4;
68
- return _App.tApp.reset();
73
+ return _App.tApp.stop();
69
74
  case 4:
75
+ (0, _App.getLocationManager)().cancelCurrentCalculation();
76
+ _context.next = 7;
77
+ return _App.tApp.reset();
78
+ case 7:
70
79
  link = _TUtil.TUtil.getFullLink(link);
71
80
  if (this.pageCache[link]) {
72
- _context.next = 15;
81
+ _context.next = 18;
73
82
  break;
74
83
  }
75
84
  _App.tApp.tRoot.$dom.innerHTML("");
@@ -77,12 +86,12 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
77
86
  _App.App.tmodelIdMap = {};
78
87
  _App.tApp.tRoot = _App.tApp.tRootFactory();
79
88
  this.lastLink = link;
80
- _context.next = 13;
89
+ _context.next = 16;
81
90
  return _App.tApp.start();
82
- case 13:
83
- _context.next = 30;
91
+ case 16:
92
+ _context.next = 34;
84
93
  break;
85
- case 15:
94
+ case 18:
86
95
  _App.tApp.tRoot = this.pageCache[link].tRoot;
87
96
  _App.App.oids = this.pageCache[link].oids;
88
97
  _App.App.tmodelIdMap = this.pageCache[link].tmodelIdMap;
@@ -93,17 +102,18 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
93
102
  visibles.forEach(function (tmodel) {
94
103
  tmodel.visibilityStatus = undefined;
95
104
  });
105
+ _App.tApp.manager.activatePendingTargetsAfterDom(visibles);
96
106
  _App.tApp.manager.visibleOidMap = _objectSpread({}, this.pageCache[link].visibleOidMap);
97
107
  newVisibles.forEach(function (visible) {
98
108
  _App.tApp.manager.visibleOidMap[visible.oid] = visible;
99
109
  });
100
110
  window.scrollTo(this.pageCache[link].scrollLeft, this.pageCache[link].scrollTop);
101
111
  this.lastLink = link;
102
- _context.next = 29;
112
+ _context.next = 33;
103
113
  return _App.tApp.start();
104
- case 29:
114
+ case 33:
105
115
  (0, _App.getRunScheduler)().restoreSnapshot(this.pageCache[link].runSnapshot);
106
- case 30:
116
+ case 34:
107
117
  case "end":
108
118
  return _context.stop();
109
119
  }
@@ -118,30 +128,25 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
118
128
  key: "openLinkFromHistory",
119
129
  value: function () {
120
130
  var _openLinkFromHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(state) {
131
+ var link;
121
132
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
122
133
  while (1) switch (_context2.prev = _context2.next) {
123
134
  case 0:
124
- if (!state.link) {
125
- _context2.next = 6;
135
+ link = state.link || state.browserUrl;
136
+ if (link) {
137
+ _context2.next = 3;
126
138
  break;
127
139
  }
128
- this.onPageClose();
129
- _context2.next = 4;
130
- return this.openLink(state.link, false);
131
- case 4:
132
- _context2.next = 10;
133
- break;
134
- case 6:
135
- if (!state.browserUrl) {
136
- _context2.next = 10;
137
- break;
140
+ return _context2.abrupt("return");
141
+ case 3:
142
+ if (state.browserUrl) {
143
+ history.replaceState({
144
+ link: link
145
+ }, "", link);
138
146
  }
139
- history.replaceState({
140
- link: state.browserUrl
141
- }, "", state.browserUrl);
142
- _context2.next = 10;
143
- return this.openPage(state.browserUrl);
144
- case 10:
147
+ _context2.next = 6;
148
+ return this.openLink(link, false);
149
+ case 6:
145
150
  case "end":
146
151
  return _context2.stop();
147
152
  }
@@ -166,6 +171,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
166
171
  value: function () {
167
172
  var _openLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(link) {
168
173
  var updateHistory,
174
+ runSnapshot,
169
175
  html,
170
176
  _args3 = arguments;
171
177
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -173,32 +179,42 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
173
179
  case 0:
174
180
  updateHistory = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : true;
175
181
  link = _TUtil.TUtil.getFullLink(link);
176
- if (this.lastLink) {
177
- _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
178
- html = _App.tApp.tRoot.$dom.innerHTML();
179
- this.onPageClose();
180
- this.pageCache[this.lastLink] = {
181
- link: this.lastLink,
182
- html: html,
183
- oids: _objectSpread({}, _App.App.oids),
184
- tmodelIdMap: _objectSpread({}, _App.App.tmodelIdMap),
185
- visibleOidMap: _objectSpread({}, _App.tApp.manager.visibleOidMap),
186
- scrollLeft: _$Dom.$Dom.getWindowScrollLeft() || 0,
187
- scrollTop: _$Dom.$Dom.getWindowScrollTop() || 0,
188
- tRoot: _App.tApp.tRoot,
189
- runSnapshot: (0, _App.getRunScheduler)().getSnapshot()
190
- };
182
+ if (!this.lastLink) {
183
+ _context3.next = 13;
184
+ break;
191
185
  }
186
+ runSnapshot = (0, _App.getRunScheduler)().getSnapshot();
187
+ _context3.next = 6;
188
+ return _App.tApp.stop();
189
+ case 6:
190
+ (0, _App.getLocationManager)().cancelCurrentCalculation();
191
+ this.onPageClose();
192
+ _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
193
+ html = _App.tApp.tRoot.$dom.innerHTML();
194
+ this.pageCache[this.lastLink] = {
195
+ link: this.lastLink,
196
+ html: html,
197
+ oids: _objectSpread({}, _App.App.oids),
198
+ tmodelIdMap: _objectSpread({}, _App.App.tmodelIdMap),
199
+ visibleOidMap: _objectSpread({}, _App.tApp.manager.visibleOidMap),
200
+ scrollLeft: _$Dom.$Dom.getWindowScrollLeft() || 0,
201
+ scrollTop: _$Dom.$Dom.getWindowScrollTop() || 0,
202
+ tRoot: _App.tApp.tRoot,
203
+ runSnapshot: runSnapshot
204
+ };
205
+ _context3.next = 13;
206
+ return _App.tApp.reset();
207
+ case 13:
192
208
  if (updateHistory) {
193
209
  history.pushState({
194
210
  link: link
195
211
  }, "", link);
196
212
  }
197
- _context3.next = 6;
198
- return this.openPage(link);
199
- case 6:
213
+ _context3.next = 16;
214
+ return this.openPage(link, false);
215
+ case 16:
200
216
  (0, _App.getRunScheduler)().schedule(0, "pagemanager-processOpenLink");
201
- case 7:
217
+ case 17:
202
218
  case "end":
203
219
  return _context3.stop();
204
220
  }
package/build/TModel.js CHANGED
@@ -326,6 +326,16 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
326
326
  }
327
327
  return this;
328
328
  }
329
+ }, {
330
+ key: "exists",
331
+ value: function exists() {
332
+ var parent = this.getParent();
333
+ if (!parent) {
334
+ return false;
335
+ }
336
+ parent.getChildren();
337
+ return parent.allChildrenMap[this.oid] === this;
338
+ }
329
339
  }, {
330
340
  key: "addToParentVisibleChildren",
331
341
  value: function addToParentVisibleChildren() {
@@ -92,7 +92,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
92
92
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
93
93
  var tmodel = _step.value;
94
94
  lastVisibleMap[tmodel.oid] = undefined;
95
- if (!_App.App.tmodelIdMap[tmodel.oid]) {
95
+ if (!tmodel.exists()) {
96
96
  if (tmodel.hasDom()) {
97
97
  this.addToInvisibleDom(tmodel);
98
98
  }
@@ -181,7 +181,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
181
181
  return v !== undefined;
182
182
  }).forEach(function (tmodel) {
183
183
  if (tmodel.hasDom()) {
184
- if (!_App.App.tmodelIdMap[tmodel.oid] || !tmodel.isIncluded()) {
184
+ if (!tmodel.exists() || !tmodel.isIncluded()) {
185
185
  _this.addToInvisibleDom(tmodel);
186
186
  }
187
187
  }
@@ -467,6 +467,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
467
467
  if (pending !== null && pending !== void 0 && pending.size) {
468
468
  for (var _i = 0, _arr = _toConsumableArray(pending); _i < _arr.length; _i++) {
469
469
  var target = _arr[_i];
470
+ _TargetUtil.TargetUtil.cleanupTarget(tmodel, target);
470
471
  _TargetUtil.TargetUtil.shouldActivateNextTarget(tmodel, target);
471
472
  }
472
473
  }
package/build/TUtil.js CHANGED
@@ -86,12 +86,12 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
86
86
  while (container && container !== (0, _App.tRoot)()) {
87
87
  if (this.shouldClipByAncestor(container)) {
88
88
  var ancestorRect = this.getAncestorViewportRect(container);
89
- rect = rect ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
89
+ rect = rect && !container.allTargetMap['onWindowScroll'] ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
90
90
  if (rect.r <= rect.x || rect.b <= rect.y) {
91
91
  break;
92
92
  }
93
93
  }
94
- container = container.getParent();
94
+ container = container.getRealParent();
95
95
  }
96
96
  return rect;
97
97
  }
@@ -297,7 +297,8 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
297
297
  var g = _step.value;
298
298
  var gtab = g.isVisible() ? tab + '| ' : tab + 'x ';
299
299
  if (g.type === 'BI') {
300
- console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " n-e-s:").concat(Math.floor(g.viewport.yNorth), "-").concat(Math.floor(g.viewport.yEast), "-").concat(Math.floor(g.viewport.ySouth), " w:").concat(Math.floor(g.getBaseWidth()), " ww:").concat(Math.floor(g.getContentWidth()), " h:").concat(Math.floor(g.getBaseHeight()), " hh:").concat(Math.floor(g.getContentHeight())));
300
+ var _g$viewport, _g$viewport2, _g$viewport3;
301
+ console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " n-e-s:").concat(Math.floor((_g$viewport = g.viewport) === null || _g$viewport === void 0 ? void 0 : _g$viewport.yNorth), "-").concat(Math.floor((_g$viewport2 = g.viewport) === null || _g$viewport2 === void 0 ? void 0 : _g$viewport2.yEast), "-").concat(Math.floor((_g$viewport3 = g.viewport) === null || _g$viewport3 === void 0 ? void 0 : _g$viewport3.ySouth), " w:").concat(Math.floor(g.getBaseWidth()), " ww:").concat(Math.floor(g.getContentWidth()), " h:").concat(Math.floor(g.getBaseHeight()), " hh:").concat(Math.floor(g.getContentHeight())));
301
302
  } else {
302
303
  console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), " absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " w:").concat(Math.floor(g.getWidth()), " h:").concat(Math.floor(g.getHeight()), " hc:").concat(Math.floor(g.getContentHeight())));
303
304
  }
@@ -7,13 +7,13 @@ exports.TargetUtil = void 0;
7
7
  var _App = require("./App.js");
8
8
  var _TUtil = require("./TUtil.js");
9
9
  var _TargetData = require("./TargetData.js");
10
+ 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); }
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; } } }; }
10
12
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
13
  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."); }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
15
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
16
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
14
- 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
- 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; } } }; }
16
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
17
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
18
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
19
  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); } }
@@ -203,7 +203,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
203
203
  if (prevOk === true) {
204
204
  TargetUtil.activateTargetOnce(tmodel, nextTarget);
205
205
  nextTargetActivated = true;
206
- TargetUtil.clearPendingTargets(tmodel, key);
206
+ TargetUtil.clearPendingTargetsForNextTarget(tmodel, nextTarget);
207
207
  tmodel.targetValues[nextTarget].triggeredByCompleteCount = targetValue.completeCount;
208
208
  } else {
209
209
  TargetUtil.markPendingTargets(tmodel, key);
@@ -224,7 +224,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
224
224
  tmodel.removeFromActiveTargets(nextTarget);
225
225
  TargetUtil.activateTarget(tmodel, nextTarget);
226
226
  nextTargetActivated = true;
227
- TargetUtil.clearPendingTargets(tmodel, key);
227
+ TargetUtil.clearPendingTargetsForNextTarget(tmodel, nextTarget);
228
228
  tmodel.targetValues[nextTarget].triggeredByCompleteCount = targetValue.completeCount;
229
229
  } else {
230
230
  TargetUtil.markPendingTargets(tmodel, key);
@@ -269,8 +269,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
269
269
  (tmodel.pendingTargets || (tmodel.pendingTargets = new Set())).add(key);
270
270
  }
271
271
  }, {
272
- key: "clearPendingTargets",
273
- value: function clearPendingTargets(tmodel, key) {
272
+ key: "clearPendingTarget",
273
+ value: function clearPendingTarget(tmodel, key) {
274
274
  var pending = tmodel.pendingTargets;
275
275
  if (!pending) {
276
276
  return;
@@ -280,11 +280,29 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
280
280
  tmodel.pendingTargets = undefined;
281
281
  }
282
282
  }
283
+ }, {
284
+ key: "clearPendingTargetsForNextTarget",
285
+ value: function clearPendingTargetsForNextTarget(tmodel, nextTarget) {
286
+ var pending = tmodel.pendingTargets;
287
+ if (!pending) {
288
+ return;
289
+ }
290
+ for (var _i = 0, _arr = _toConsumableArray(pending); _i < _arr.length; _i++) {
291
+ var _tmodel$targets$key;
292
+ var key = _arr[_i];
293
+ if (((_tmodel$targets$key = tmodel.targets[key]) === null || _tmodel$targets$key === void 0 ? void 0 : _tmodel$targets$key.activateNextTarget) === nextTarget) {
294
+ pending.delete(key);
295
+ }
296
+ }
297
+ if (pending.size === 0) {
298
+ tmodel.pendingTargets = undefined;
299
+ }
300
+ }
283
301
  }, {
284
302
  key: "cleanupTarget",
285
303
  value: function cleanupTarget(tmodel, key) {
286
304
  if (tmodel.isTargetComplete(key) || !TargetUtil.isTargetFullyCompleted(tmodel, key)) {
287
- return;
305
+ return false;
288
306
  }
289
307
  tmodel.setTargetComplete(key);
290
308
  var target = tmodel.targets[key];
@@ -301,6 +319,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
301
319
  target.fetchAction = false;
302
320
  }
303
321
  TargetUtil.bubbleInvokerCompletion(tmodel, key);
322
+ return true;
304
323
  }
305
324
  }, {
306
325
  key: "bubbleInvokerCompletion",
@@ -333,9 +352,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
333
352
  };
334
353
  tryCleanupAndBubble(targetValue.originalTModel, targetValue.originalTargetName);
335
354
  if (!tmodel.isTargetImperative(key)) {
336
- var _tmodel$targets$key, _tmodel$targets$key2;
355
+ var _tmodel$targets$key2, _tmodel$targets$key3;
337
356
  tryCleanupAndBubble(targetValue.invokerTModel, targetValue.invokerTargetName);
338
- tryCleanupAndBubble((_tmodel$targets$key = tmodel.targets[key]) === null || _tmodel$targets$key === void 0 ? void 0 : _tmodel$targets$key.originalTModel, (_tmodel$targets$key2 = tmodel.targets[key]) === null || _tmodel$targets$key2 === void 0 ? void 0 : _tmodel$targets$key2.originalTargetName);
357
+ tryCleanupAndBubble((_tmodel$targets$key2 = tmodel.targets[key]) === null || _tmodel$targets$key2 === void 0 ? void 0 : _tmodel$targets$key2.originalTModel, (_tmodel$targets$key3 = tmodel.targets[key]) === null || _tmodel$targets$key3 === void 0 ? void 0 : _tmodel$targets$key3.originalTargetName);
339
358
  }
340
359
  }
341
360
  }, {
@@ -478,12 +497,12 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
478
497
  if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
479
498
  continue;
480
499
  }
481
- if (_App.App.tmodelIdMap[child.oid] && !TargetUtil.isTModelComplete(child)) {
482
- return false;
500
+ if (child.exists() && !TargetUtil.isTModelComplete(child)) {
501
+ return child.oid;
483
502
  }
484
503
  if (child.hasChildren()) {
485
504
  if (!TargetUtil.areTargetChildrenComplete(child.getChildren(), waitForChildren)) {
486
- return false;
505
+ return child.oid;
487
506
  }
488
507
  }
489
508
  }
@@ -642,7 +661,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
642
661
  tmodel.clearActiveChildren();
643
662
  tmodel.clearAnimatingChildren();
644
663
  (0, _App.getLocationManager)().domIslandSet.delete(tmodel);
645
- delete _App.App.tmodelIdMap[tmodel.oid];
664
+ if (_App.App.tmodelIdMap[tmodel.oid] === tmodel) {
665
+ delete _App.App.tmodelIdMap[tmodel.oid];
666
+ }
646
667
  }
647
668
  }, {
648
669
  key: "getOriginalNames",
@@ -653,9 +674,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
653
674
  originalTModel = (_tmodel$targetValues$6 = tmodel.targetValues[key]) === null || _tmodel$targetValues$6 === void 0 ? void 0 : _tmodel$targetValues$6.originalTModel;
654
675
  originalTargetName = (_tmodel$targetValues$7 = tmodel.targetValues[key]) === null || _tmodel$targetValues$7 === void 0 ? void 0 : _tmodel$targetValues$7.originalTargetName;
655
676
  } else {
656
- var _tmodel$targets$key3, _tmodel$targets$key4;
657
- originalTModel = (_tmodel$targets$key3 = tmodel.targets[key]) === null || _tmodel$targets$key3 === void 0 ? void 0 : _tmodel$targets$key3.originalTModel;
658
- originalTargetName = (_tmodel$targets$key4 = tmodel.targets[key]) === null || _tmodel$targets$key4 === void 0 ? void 0 : _tmodel$targets$key4.originalTargetName;
677
+ var _tmodel$targets$key4, _tmodel$targets$key5;
678
+ originalTModel = (_tmodel$targets$key4 = tmodel.targets[key]) === null || _tmodel$targets$key4 === void 0 ? void 0 : _tmodel$targets$key4.originalTModel;
679
+ originalTargetName = (_tmodel$targets$key5 = tmodel.targets[key]) === null || _tmodel$targets$key5 === void 0 ? void 0 : _tmodel$targets$key5.originalTargetName;
659
680
  }
660
681
  return {
661
682
  originalTModel: originalTModel,
@@ -746,7 +767,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
746
767
  tmodel.removeFromActiveTargets(key);
747
768
  tmodel.removeFromAnimatingMap(key);
748
769
  tmodel.removeFromUpdatingTargets(key);
749
- TargetUtil.clearPendingTargets(tmodel, key);
770
+ TargetUtil.clearPendingTarget(tmodel, key);
750
771
  }
751
772
  }]);
752
773
  }();