targetj 1.0.260 → 1.1.1

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.
@@ -174,13 +174,14 @@ var TargetUtil = /*#__PURE__*/function () {
174
174
  }
175
175
  var nextTarget = target.activateNextTarget;
176
176
  var isEndTrigger = (_nextTarget$endsWith = nextTarget === null || nextTarget === void 0 ? void 0 : nextTarget.endsWith('$$')) !== null && _nextTarget$endsWith !== void 0 ? _nextTarget$endsWith : false;
177
- var fetchAction = target.fetchAction;
177
+ var fetchAction = TargetUtil.hasFetchAction(tmodel, key);
178
178
  if (isUpdateMode && isEndTrigger) {
179
179
  return;
180
180
  }
181
181
  var nextTargetActivated = false;
182
182
  var canActivate = false;
183
183
  if (nextTarget) {
184
+ var waitingForDom = TargetData.requiresDom(TargetUtil.getTargetName(nextTarget)) && !tmodel.hasDom();
184
185
  if (isEndTrigger) {
185
186
  var lastTriggeredCount = TargetUtil.getTriggeredByCompleteCount(tmodel, nextTarget, key);
186
187
  if (targetValue.completeCount > lastTriggeredCount) {
@@ -193,7 +194,13 @@ var TargetUtil = /*#__PURE__*/function () {
193
194
  }
194
195
  if (!isEndTrigger && sideStep === 0 && (canActivate || isImperative) || isEndTrigger && canActivate) {
195
196
  var prevOk = isEndTrigger ? TargetUtil.arePreviousTargetsComplete(tmodel, nextTarget) : false;
196
- if (fetchAction) {
197
+ if (isEndTrigger) {
198
+ var _tmodel$targetValues, _tmodel$targetValues$2;
199
+ ((_tmodel$targetValues$2 = (_tmodel$targetValues = tmodel.targetValues)[nextTarget]) !== null && _tmodel$targetValues$2 !== void 0 ? _tmodel$targetValues$2 : _tmodel$targetValues[nextTarget] = TargetUtil.emptyValue()).previousTargetsStatus = prevOk;
200
+ }
201
+ if (waitingForDom) {
202
+ TargetUtil.markPendingTargets(tmodel, key);
203
+ } else if (fetchAction) {
197
204
  if (isEndTrigger) {
198
205
  if (prevOk === true) {
199
206
  var activated = TargetUtil.activateTargetOnce(tmodel, nextTarget);
@@ -223,7 +230,7 @@ var TargetUtil = /*#__PURE__*/function () {
223
230
  } else {
224
231
  TargetUtil.markPendingTargets(tmodel, key);
225
232
  }
226
- } else if (!isEndTrigger) {
233
+ } else {
227
234
  if (tmodel.activatedTargets.indexOf(nextTarget) >= 0 && !tmodel.isTargetUpdating(key)) {
228
235
  tmodel.activatedTargets.push(nextTarget);
229
236
  } else {
@@ -254,7 +261,11 @@ var TargetUtil = /*#__PURE__*/function () {
254
261
  var _originalTModel = target.originalTModel,
255
262
  _originalTargetName = target.originalTargetName;
256
263
  if (_originalTModel && _originalTargetName) {
257
- TargetUtil.shouldActivateNextTarget(_originalTModel, _originalTargetName, levelUp + 1, sideStep, isImperative, "complete");
264
+ var _originalTModel$targe, _originalTModel$targe2;
265
+ var completionScope = (_originalTModel$targe = (_originalTModel$targe2 = _originalTModel.targets[_originalTargetName]) === null || _originalTModel$targe2 === void 0 ? void 0 : _originalTModel$targe2.completionScope) !== null && _originalTModel$targe !== void 0 ? _originalTModel$targe : "all";
266
+ if (completionScope !== "none" && TargetUtil.isTModelComplete(tmodel, completionScope)) {
267
+ TargetUtil.shouldActivateNextTarget(_originalTModel, _originalTargetName, levelUp + 1, sideStep, isImperative, "complete");
268
+ }
258
269
  }
259
270
  }
260
271
  }
@@ -311,13 +322,11 @@ var TargetUtil = /*#__PURE__*/function () {
311
322
  target.onComplete.call(tmodel);
312
323
  tmodel.setTargetMethodName(key, "onComplete");
313
324
  }
314
- var fetchAction = target === null || target === void 0 ? void 0 : target.fetchAction;
315
- if (fetchAction && getLoader().isLoadingSuccessful(tmodel, key)) {
325
+ if (TargetUtil.hasFetchAction(tmodel, key) && getLoader().isLoadingSuccessful(tmodel, key)) {
316
326
  var index = tmodel.fetchActionTargetList.indexOf(key);
317
327
  if (index >= 0) {
318
328
  tmodel.fetchActionTargetList.splice(index, 1);
319
329
  }
320
- target.fetchAction = false;
321
330
  }
322
331
  TargetUtil.bubbleInvokerCompletion(tmodel, key);
323
332
  return true;
@@ -391,35 +400,35 @@ var TargetUtil = /*#__PURE__*/function () {
391
400
  }, {
392
401
  key: "getTriggeredByCompleteCount",
393
402
  value: function getTriggeredByCompleteCount(tmodel, nextTarget, key) {
394
- var _tmodel$targetValues$2, _tmodel$targetValues$3;
395
- return (_tmodel$targetValues$2 = (_tmodel$targetValues$3 = tmodel.targetValues[nextTarget]) === null || _tmodel$targetValues$3 === void 0 || (_tmodel$targetValues$3 = _tmodel$targetValues$3.triggeredByCompleteCountMap) === null || _tmodel$targetValues$3 === void 0 ? void 0 : _tmodel$targetValues$3.get(key)) !== null && _tmodel$targetValues$2 !== void 0 ? _tmodel$targetValues$2 : 0;
403
+ var _tmodel$targetValues$3, _tmodel$targetValues$4;
404
+ return (_tmodel$targetValues$3 = (_tmodel$targetValues$4 = tmodel.targetValues[nextTarget]) === null || _tmodel$targetValues$4 === void 0 || (_tmodel$targetValues$4 = _tmodel$targetValues$4.triggeredByCompleteCountMap) === null || _tmodel$targetValues$4 === void 0 ? void 0 : _tmodel$targetValues$4.get(key)) !== null && _tmodel$targetValues$3 !== void 0 ? _tmodel$targetValues$3 : 0;
396
405
  }
397
406
  }, {
398
407
  key: "snapshotTriggeredByCompleteCounts",
399
408
  value: function snapshotTriggeredByCompleteCounts(tmodel, nextTarget) {
400
- var _tmodel$targetValues;
401
- var nextTargetValue = (_tmodel$targetValues = tmodel.targetValues)[nextTarget] || (_tmodel$targetValues[nextTarget] = TargetUtil.emptyValue());
409
+ var _tmodel$targetValues2;
410
+ var nextTargetValue = (_tmodel$targetValues2 = tmodel.targetValues)[nextTarget] || (_tmodel$targetValues2[nextTarget] = TargetUtil.emptyValue());
402
411
  var map = nextTargetValue.triggeredByCompleteCountMap || (nextTargetValue.triggeredByCompleteCountMap = new Map());
403
412
  var nextIndex = tmodel.functionTargetNames.indexOf(nextTarget);
404
413
  if (nextIndex < 0) {
405
414
  return;
406
415
  }
407
416
  for (var i = 0; i < nextIndex; i++) {
408
- var _tmodel$targetValues$4, _tmodel$targetValues$5;
417
+ var _tmodel$targetValues$5, _tmodel$targetValues$6;
409
418
  var previousKey = tmodel.functionTargetNames[i];
410
419
  var previousTarget = tmodel.targets[previousKey];
411
420
  if ((previousTarget === null || previousTarget === void 0 ? void 0 : previousTarget.activateNextTarget) !== nextTarget) {
412
421
  continue;
413
422
  }
414
- var completeCount = (_tmodel$targetValues$4 = (_tmodel$targetValues$5 = tmodel.targetValues[previousKey]) === null || _tmodel$targetValues$5 === void 0 ? void 0 : _tmodel$targetValues$5.completeCount) !== null && _tmodel$targetValues$4 !== void 0 ? _tmodel$targetValues$4 : 0;
423
+ var completeCount = (_tmodel$targetValues$5 = (_tmodel$targetValues$6 = tmodel.targetValues[previousKey]) === null || _tmodel$targetValues$6 === void 0 ? void 0 : _tmodel$targetValues$6.completeCount) !== null && _tmodel$targetValues$5 !== void 0 ? _tmodel$targetValues$5 : 0;
415
424
  map.set(previousKey, completeCount);
416
425
  }
417
426
  }
418
427
  }, {
419
428
  key: "activateTargetOnce",
420
429
  value: function activateTargetOnce(tmodel, nextTarget) {
421
- var _tmodel$targetValues2, _nextTargetValue$acti;
422
- var nextTargetValue = (_tmodel$targetValues2 = tmodel.targetValues)[nextTarget] || (_tmodel$targetValues2[nextTarget] = TargetUtil.emptyValue());
430
+ var _tmodel$targetValues3, _nextTargetValue$acti;
431
+ var nextTargetValue = (_tmodel$targetValues3 = tmodel.targetValues)[nextTarget] || (_tmodel$targetValues3[nextTarget] = TargetUtil.emptyValue());
423
432
  var last = (_nextTargetValue$acti = nextTargetValue.activationTime) !== null && _nextTargetValue$acti !== void 0 ? _nextTargetValue$acti : 0;
424
433
  if (last > 0 && last >= tmodel.getLastUpdate(nextTarget)) {
425
434
  return false;
@@ -436,33 +445,42 @@ var TargetUtil = /*#__PURE__*/function () {
436
445
  }, {
437
446
  key: "isTModelComplete",
438
447
  value: function isTModelComplete(tmodel) {
439
- var _state$updatingTarget2, _state$activeTargetLi2, _state$activatedTarge2, _state$lastChildrenUp3, _state$lastChildrenUp4;
448
+ var _tmodel$particleRunti, _state$updatingTarget2, _state$activeTargetLi2, _state$activatedTarge2, _state$lastChildrenUp3, _state$lastChildrenUp4;
440
449
  var completionScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
450
+ if (completionScope === "visible" && TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
451
+ return true;
452
+ }
453
+ if ((_tmodel$particleRunti = tmodel.particleRuntime) !== null && _tmodel$particleRunti !== void 0 && _tmodel$particleRunti.hasPendingAny(completionScope)) {
454
+ return false;
455
+ }
456
+ var waitingForDom = !tmodel.isLightweightChild && getManager().shouldHaveDom(tmodel) && !tmodel.hasDom();
441
457
  var state = tmodel.state();
458
+ var pendingStyles = !tmodel.isLightweightChild && TargetUtil.hasPendingStyles(tmodel);
459
+ var needsReattach = !tmodel.isLightweightChild && getManager().needsReattach(tmodel);
442
460
  if (completionScope === "visible") {
443
461
  var _state$updatingTarget, _state$activeTargetLi, _state$activatedTarge, _state$lastChildrenUp, _state$lastChildrenUp2;
444
- if (TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
445
- return true;
446
- }
447
- return !((_state$updatingTarget = state.updatingTargetList) !== null && _state$updatingTarget !== void 0 && _state$updatingTarget.length) && !((_state$activeTargetLi = state.activeTargetList) !== null && _state$activeTargetLi !== void 0 && _state$activeTargetLi.length) && !((_state$activatedTarge = state.activatedTargets) !== null && _state$activatedTarge !== void 0 && _state$activatedTarge.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").size === 0 && TargetUtil.getActiveChildren(tmodel, "visible").size === 0 && !((_state$lastChildrenUp = state.lastChildrenUpdate) !== null && _state$lastChildrenUp !== void 0 && (_state$lastChildrenUp = _state$lastChildrenUp.deletions) !== null && _state$lastChildrenUp !== void 0 && _state$lastChildrenUp.length) && !((_state$lastChildrenUp2 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp2 !== void 0 && (_state$lastChildrenUp2 = _state$lastChildrenUp2.additions) !== null && _state$lastChildrenUp2 !== void 0 && _state$lastChildrenUp2.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !getManager().needsReattach(tmodel);
462
+ return !waitingForDom && !((_state$updatingTarget = state.updatingTargetList) !== null && _state$updatingTarget !== void 0 && _state$updatingTarget.length) && !((_state$activeTargetLi = state.activeTargetList) !== null && _state$activeTargetLi !== void 0 && _state$activeTargetLi.length) && !((_state$activatedTarge = state.activatedTargets) !== null && _state$activatedTarge !== void 0 && _state$activatedTarge.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").size === 0 && TargetUtil.getActiveChildren(tmodel, "visible").size === 0 && !((_state$lastChildrenUp = state.lastChildrenUpdate) !== null && _state$lastChildrenUp !== void 0 && (_state$lastChildrenUp = _state$lastChildrenUp.deletions) !== null && _state$lastChildrenUp !== void 0 && _state$lastChildrenUp.length) && !((_state$lastChildrenUp2 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp2 !== void 0 && (_state$lastChildrenUp2 = _state$lastChildrenUp2.additions) !== null && _state$lastChildrenUp2 !== void 0 && _state$lastChildrenUp2.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !pendingStyles && !needsReattach;
448
463
  }
449
- return !((_state$updatingTarget2 = state.updatingTargetList) !== null && _state$updatingTarget2 !== void 0 && _state$updatingTarget2.length) && !((_state$activeTargetLi2 = state.activeTargetList) !== null && _state$activeTargetLi2 !== void 0 && _state$activeTargetLi2.length) && !((_state$activatedTarge2 = state.activatedTargets) !== null && _state$activatedTarge2 !== void 0 && _state$activatedTarge2.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && !tmodel.hasAnimatingChildren() && !tmodel.hasUpdatingChildren() && !tmodel.hasActiveChildren() && !((_state$lastChildrenUp3 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp3 !== void 0 && (_state$lastChildrenUp3 = _state$lastChildrenUp3.deletions) !== null && _state$lastChildrenUp3 !== void 0 && _state$lastChildrenUp3.length) && !((_state$lastChildrenUp4 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp4 !== void 0 && (_state$lastChildrenUp4 = _state$lastChildrenUp4.additions) !== null && _state$lastChildrenUp4 !== void 0 && _state$lastChildrenUp4.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !getManager().needsReattach(tmodel);
464
+ return !waitingForDom && !((_state$updatingTarget2 = state.updatingTargetList) !== null && _state$updatingTarget2 !== void 0 && _state$updatingTarget2.length) && !((_state$activeTargetLi2 = state.activeTargetList) !== null && _state$activeTargetLi2 !== void 0 && _state$activeTargetLi2.length) && !((_state$activatedTarge2 = state.activatedTargets) !== null && _state$activatedTarge2 !== void 0 && _state$activatedTarge2.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && !tmodel.hasAnimatingChildren() && !tmodel.hasUpdatingChildren() && !tmodel.hasActiveChildren() && !((_state$lastChildrenUp3 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp3 !== void 0 && (_state$lastChildrenUp3 = _state$lastChildrenUp3.deletions) !== null && _state$lastChildrenUp3 !== void 0 && _state$lastChildrenUp3.length) && !((_state$lastChildrenUp4 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp4 !== void 0 && (_state$lastChildrenUp4 = _state$lastChildrenUp4.additions) !== null && _state$lastChildrenUp4 !== void 0 && _state$lastChildrenUp4.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !pendingStyles && !needsReattach;
450
465
  }
451
466
  }, {
452
467
  key: "getCompletionBlockers",
453
468
  value: function getCompletionBlockers(tmodel) {
454
- var _state$lastChildrenUp7, _state$lastChildrenUp8;
469
+ var _state$lastChildrenUp5, _state$lastChildrenUp6;
455
470
  var completionScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
471
+ var visible = completionScope === "visible";
472
+ if (visible && TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
473
+ return [];
474
+ }
456
475
  var state = tmodel.state();
457
476
  var blockers = [];
458
477
  var add = function add(name, value) {
459
- if (!value) {
460
- return;
478
+ if (value && (!Array.isArray(value) || value.length > 0)) {
479
+ blockers.push({
480
+ name: name,
481
+ value: value
482
+ });
461
483
  }
462
- blockers.push({
463
- name: name,
464
- value: value
465
- });
466
484
  };
467
485
  var list = function list(value) {
468
486
  if (!value) {
@@ -474,56 +492,38 @@ var TargetUtil = /*#__PURE__*/function () {
474
492
  if (value instanceof Map) {
475
493
  return _toConsumableArray(value.keys());
476
494
  }
477
- if (Array.isArray(value)) {
478
- return value;
479
- }
480
- return [value];
495
+ return Array.isArray(value) ? value : [value];
481
496
  };
482
- if (completionScope === "visible") {
483
- var _state$lastChildrenUp5, _state$lastChildrenUp6;
484
- if (TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
485
- return [];
486
- }
487
- var updatingChildren = TargetUtil.getUpdatingChildren(tmodel, undefined, "visible");
488
- var activeChildren = TargetUtil.getActiveChildren(tmodel, "visible");
489
- add("updatingTargetList", list(state.updatingTargetList));
490
- add("activeTargetList", list(state.activeTargetList));
491
- add("activatedTargets", list(state.activatedTargets));
492
- add("animatingTargets", tmodel.hasAnimatingTargets() ? list(tmodel.animatingMap) : []);
493
- add("fetching", !TargetUtil.isFetchingComplete(tmodel) ? true : false);
494
- add("updatingChildren", _toConsumableArray(updatingChildren.keys()));
495
- add("activeChildren", _toConsumableArray(activeChildren.keys()));
496
- add("deletedChildren", list((_state$lastChildrenUp5 = state.lastChildrenUpdate) === null || _state$lastChildrenUp5 === void 0 ? void 0 : _state$lastChildrenUp5.deletions));
497
- add("addedChildren", list((_state$lastChildrenUp6 = state.lastChildrenUpdate) === null || _state$lastChildrenUp6 === void 0 ? void 0 : _state$lastChildrenUp6.additions));
498
- add("noDomUpdatingTargets", list(tmodel.noDomUpdatingTargets));
499
- add("pendingTargets", list(tmodel.pendingTargets));
500
- add("needsReattach", getManager().needsReattach(tmodel) ? true : false);
501
- return blockers.filter(function (blocker) {
502
- if (Array.isArray(blocker.value)) {
503
- return blocker.value.length > 0;
504
- }
505
- return !!blocker.value;
506
- });
507
- }
497
+ add("waitingForDom", !tmodel.isLightweightChild && getManager().shouldHaveDom(tmodel) && !tmodel.hasDom());
508
498
  add("updatingTargetList", list(state.updatingTargetList));
509
499
  add("activeTargetList", list(state.activeTargetList));
510
500
  add("activatedTargets", list(state.activatedTargets));
511
501
  add("animatingTargets", tmodel.hasAnimatingTargets() ? list(tmodel.animatingMap) : []);
512
- add("fetching", !TargetUtil.isFetchingComplete(tmodel) ? true : false);
513
- add("animatingChildren", tmodel.hasAnimatingChildren() ? true : false);
514
- add("updatingChildren", tmodel.hasUpdatingChildren() ? list(tmodel.updatingChildrenMap) : []);
515
- add("activeChildren", tmodel.hasActiveChildren() ? list(tmodel.activeChildrenMap) : []);
516
- add("deletedChildren", list((_state$lastChildrenUp7 = state.lastChildrenUpdate) === null || _state$lastChildrenUp7 === void 0 ? void 0 : _state$lastChildrenUp7.deletions));
517
- add("addedChildren", list((_state$lastChildrenUp8 = state.lastChildrenUpdate) === null || _state$lastChildrenUp8 === void 0 ? void 0 : _state$lastChildrenUp8.additions));
502
+ add("fetching", !TargetUtil.isFetchingComplete(tmodel));
503
+ if (visible) {
504
+ add("updatingChildren", _toConsumableArray(TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").keys()));
505
+ add("activeChildren", _toConsumableArray(TargetUtil.getActiveChildren(tmodel, "visible").keys()));
506
+ } else {
507
+ add("animatingChildren", tmodel.hasAnimatingChildren());
508
+ add("updatingChildren", tmodel.hasUpdatingChildren() ? list(tmodel.updatingChildrenMap) : []);
509
+ add("activeChildren", tmodel.hasActiveChildren() ? list(tmodel.activeChildrenMap) : []);
510
+ }
511
+ add("deletedChildren", list((_state$lastChildrenUp5 = state.lastChildrenUpdate) === null || _state$lastChildrenUp5 === void 0 ? void 0 : _state$lastChildrenUp5.deletions));
512
+ add("addedChildren", list((_state$lastChildrenUp6 = state.lastChildrenUpdate) === null || _state$lastChildrenUp6 === void 0 ? void 0 : _state$lastChildrenUp6.additions));
518
513
  add("noDomUpdatingTargets", list(tmodel.noDomUpdatingTargets));
519
514
  add("pendingTargets", list(tmodel.pendingTargets));
520
- add("needsReattach", getManager().needsReattach(tmodel) ? true : false);
521
- return blockers.filter(function (blocker) {
522
- if (Array.isArray(blocker.value)) {
523
- return blocker.value.length > 0;
524
- }
525
- return !!blocker.value;
526
- });
515
+ if (tmodel.hasDom()) {
516
+ add("styleTargetMap", list(tmodel.styleTargetMap));
517
+ add("asyncStyleTargetMap", list(tmodel.asyncStyleTargetMap));
518
+ }
519
+ add("needsReattach", getManager().needsReattach(tmodel));
520
+ return blockers;
521
+ }
522
+ }, {
523
+ key: "hasPendingStyles",
524
+ value: function hasPendingStyles(tmodel) {
525
+ var _tmodel$styleTargetMa, _tmodel$asyncStyleTar;
526
+ return tmodel.hasDom() && (((_tmodel$styleTargetMa = tmodel.styleTargetMap) === null || _tmodel$styleTargetMa === void 0 ? void 0 : _tmodel$styleTargetMa.size) > 0 || ((_tmodel$asyncStyleTar = tmodel.asyncStyleTargetMap) === null || _tmodel$asyncStyleTar === void 0 ? void 0 : _tmodel$asyncStyleTar.size) > 0);
527
527
  }
528
528
  }, {
529
529
  key: "isFetchingComplete",
@@ -567,11 +567,17 @@ var TargetUtil = /*#__PURE__*/function () {
567
567
  var keyIndex = tmodel.functionTargetNames.findIndex(function (name) {
568
568
  return key === name;
569
569
  });
570
+ if (TargetUtil.hasPendingStyles(tmodel)) {
571
+ return "pending styles";
572
+ }
570
573
  for (var i = keyIndex - 1; i >= 0; i--) {
571
574
  var targetName = tmodel.functionTargetNames[i];
572
575
  if (tmodel.isTargetImperative(targetName)) {
573
576
  continue;
574
577
  }
578
+ if (tmodel.isTargetComplete(targetName)) {
579
+ continue;
580
+ }
575
581
  if (tmodel.activatedTargets.indexOf(targetName) >= 0) {
576
582
  return "activated targets";
577
583
  }
@@ -579,9 +585,12 @@ var TargetUtil = /*#__PURE__*/function () {
579
585
  return tmodel.oid + "." + targetName + ": " + tmodel.getUpdatingImperativeTargets(targetName);
580
586
  }
581
587
  if (tmodel.isTargetTreeComplete(targetName) !== true) {
582
- //const activeChildrenList = [ ...TargetUtil.getActiveChildren(tmodel, tmodel.targets[targetName].completionScope).values() ];
583
- //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + TargetUtil.isTargetTreeComplete(tmodel, targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName, tmodel.targets[targetName].completionScope).keys() ];
584
- return false;
588
+ var _tmodel$targets$targe;
589
+ var completionScope = (_tmodel$targets$targe = tmodel.targets[targetName].completionScope) !== null && _tmodel$targets$targe !== void 0 ? _tmodel$targets$targe : "all";
590
+ var reason = TargetUtil.isTargetTreeComplete(tmodel, targetName);
591
+ var activeChildren = _toConsumableArray(TargetUtil.getActiveChildren(tmodel, completionScope).keys());
592
+ var updatingChildren = _toConsumableArray(TargetUtil.getUpdatingChildren(tmodel, targetName, completionScope).keys());
593
+ return "".concat(tmodel.oid, ".").concat(targetName, ": ").concat(reason, "; active=[").concat(activeChildren.join(", "), "]; updating=[").concat(updatingChildren.join(", "), "]");
585
594
  }
586
595
  }
587
596
  return true;
@@ -590,14 +599,19 @@ var TargetUtil = /*#__PURE__*/function () {
590
599
  key: "isTargetTreeComplete",
591
600
  value: function isTargetTreeComplete(tmodel, key, completionScopeOverride) {
592
601
  var target = tmodel.targets[key];
602
+ var targetValue = tmodel.targetValues[key];
603
+ var childAction = targetValue === null || targetValue === void 0 ? void 0 : targetValue.childAction;
593
604
  if (target) {
594
- var _target$childAction, _target$childAction2, _target$childAction3;
605
+ var _tmodel$particleRunti2, _tmodel$particleRunti3;
595
606
  var completionScope = completionScopeOverride !== null && completionScopeOverride !== void 0 ? completionScopeOverride : target.completionScope;
607
+ if ((_tmodel$particleRunti2 = tmodel.particleRuntime) !== null && _tmodel$particleRunti2 !== void 0 && _tmodel$particleRunti2.hasPending(key, completionScope !== null && completionScope !== void 0 ? completionScope : "all")) {
608
+ return "pending GPU children";
609
+ }
596
610
  var targetType = _typeof(target.value);
597
611
  if (TargetData.controlTargetMap[key]) {
598
612
  return true;
599
613
  }
600
- if (!target.fetchAction && (targetType === 'string' || targetType === 'number' || targetType === 'boolean')) {
614
+ if (!TargetUtil.hasFetchAction(tmodel, key) && (targetType === 'string' || targetType === 'number' || targetType === 'boolean')) {
601
615
  return true;
602
616
  }
603
617
  if (getManager().needsReattach(tmodel)) {
@@ -609,18 +623,22 @@ var TargetUtil = /*#__PURE__*/function () {
609
623
  if (!tmodel.isTargetComplete(key) && !tmodel.isTargetDone(key)) {
610
624
  return 'not done';
611
625
  }
612
- if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key, completionScope).size > 0) {
613
- return 'updating children';
626
+ var children;
627
+ if ((childAction === null || childAction === void 0 ? void 0 : childAction.length) > 0 && (children = TargetUtil.getUpdatingChildren(tmodel, key, completionScope)).size > 0) {
628
+ return "updating children: " + _toConsumableArray(children.keys()).join(", ");
614
629
  }
615
- if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel, completionScope).size > 0) {
616
- return 'active children';
630
+ if ((childAction === null || childAction === void 0 ? void 0 : childAction.length) > 0 && (children = TargetUtil.getActiveChildren(tmodel, completionScope)).size > 0) {
631
+ return "active children: " + _toConsumableArray(children.keys()).join(", ");
617
632
  }
618
- if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, completionScope) !== true) {
619
- return 'incomplete children';
633
+ if ((childAction === null || childAction === void 0 ? void 0 : childAction.length) > 0 && (children = TargetUtil.areTargetChildrenComplete(childAction, completionScope)) !== true) {
634
+ return "incomplete children: " + children;
620
635
  }
621
- if (target.fetchAction && !getLoader().isLoadingSuccessful(tmodel, key)) {
636
+ if (TargetUtil.hasFetchAction(tmodel, key) && !getLoader().isLoadingSuccessful(tmodel, key)) {
622
637
  return 'incomplete loading';
623
638
  }
639
+ if ((_tmodel$particleRunti3 = tmodel.particleRuntime) !== null && _tmodel$particleRunti3 !== void 0 && _tmodel$particleRunti3.hasPending(key, completionScope)) {
640
+ return "pending GPU children";
641
+ }
624
642
  }
625
643
  return true;
626
644
  }
@@ -635,7 +653,14 @@ var TargetUtil = /*#__PURE__*/function () {
635
653
  _step2;
636
654
  try {
637
655
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
656
+ var _child$visibilityStat;
638
657
  var child = _step2.value;
658
+ if (!child) {
659
+ continue;
660
+ }
661
+ if (completionScope === "visible" && !child.isLightweightChild && ((_child$visibilityStat = child.visibilityStatus) === null || _child$visibilityStat === void 0 ? void 0 : _child$visibilityStat.isVisible) === undefined) {
662
+ return "visibility not calculated";
663
+ }
639
664
  if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
640
665
  continue;
641
666
  }
@@ -684,9 +709,9 @@ var TargetUtil = /*#__PURE__*/function () {
684
709
  if (imperativeOriginalTarget === originalTargetName) {
685
710
  childrenMap.set(child.oid, child);
686
711
  } else if (imperativeOriginalTarget) {
687
- var _child$targetValues$t3, _originalTModel$targe;
712
+ var _child$targetValues$t3, _originalTModel$targe3;
688
713
  var originalTModel = (_child$targetValues$t3 = child.targetValues[target]) === null || _child$targetValues$t3 === void 0 ? void 0 : _child$targetValues$t3.originalTModel;
689
- if (((_originalTModel$targe = originalTModel.targets[imperativeOriginalTarget]) === null || _originalTModel$targe === void 0 ? void 0 : _originalTModel$targe.originalTargetName) === originalTargetName) {
714
+ if (((_originalTModel$targe3 = originalTModel.targets[imperativeOriginalTarget]) === null || _originalTModel$targe3 === void 0 ? void 0 : _originalTModel$targe3.originalTargetName) === originalTargetName) {
690
715
  childrenMap.set(child.oid, child);
691
716
  }
692
717
  }
@@ -754,6 +779,10 @@ var TargetUtil = /*#__PURE__*/function () {
754
779
  }, {
755
780
  key: "shouldIgnoreChildForCompletion",
756
781
  value: function shouldIgnoreChildForCompletion(child, completionScope) {
782
+ if (child && typeof child.exists !== "function") {
783
+ console.warn("Invalid child reference", JSON.stringify(child));
784
+ return true;
785
+ }
757
786
  if (!child || !child.exists()) {
758
787
  return true;
759
788
  }
@@ -761,8 +790,13 @@ var TargetUtil = /*#__PURE__*/function () {
761
790
  return true;
762
791
  }
763
792
  if (completionScope === "visible") {
764
- var _child$visibilityStat;
765
- return ((_child$visibilityStat = child.visibilityStatus) === null || _child$visibilityStat === void 0 ? void 0 : _child$visibilityStat.isVisible) !== true;
793
+ if (child.visibilityStatus) {
794
+ return child.visibilityStatus.isVisible !== true;
795
+ }
796
+ if (typeof child.isVisible === "function") {
797
+ return child.isVisible() !== true;
798
+ }
799
+ return true;
766
800
  }
767
801
  return false;
768
802
  }
@@ -778,44 +812,44 @@ var TargetUtil = /*#__PURE__*/function () {
778
812
  }
779
813
  }
780
814
  }, {
781
- key: "markChildAction",
782
- value: function markChildAction(parentTModel, parentTargetName, child) {
783
- var target = parentTModel.targets[parentTargetName];
784
- if (_typeof(target) === 'object') {
785
- if (!target['childAction']) {
786
- target['childAction'] = [child];
787
- } else if (!target['childAction'].includes(child)) {
788
- target['childAction'].push(child);
789
- }
815
+ key: "markTargetChildAction",
816
+ value: function markTargetChildAction(tmodel, key, child, action) {
817
+ var _tmodel$targetValues4, _tmodel$targetValues5, _targetValue$action;
818
+ if (!child || !(tmodel !== null && tmodel !== void 0 && tmodel.targets[key]) || _typeof(tmodel.targets[key]) !== "object") {
819
+ return;
790
820
  }
821
+ var targetValue = (_tmodel$targetValues5 = (_tmodel$targetValues4 = tmodel.targetValues)[key]) !== null && _tmodel$targetValues5 !== void 0 ? _tmodel$targetValues5 : _tmodel$targetValues4[key] = TargetUtil.emptyValue();
822
+ var children = (_targetValue$action = targetValue[action]) !== null && _targetValue$action !== void 0 ? _targetValue$action : targetValue[action] = [];
823
+ if (!children.includes(child)) {
824
+ children.push(child);
825
+ }
826
+ }
827
+ }, {
828
+ key: "markChildAction",
829
+ value: function markChildAction(tmodel, key, child) {
830
+ TargetUtil.markTargetChildAction(tmodel, key, child, "childAction");
791
831
  }
792
832
  }, {
793
833
  key: "markAddChild",
794
- value: function markAddChild(parentTModel, parentTargetName, child) {
795
- var target = parentTModel.targets[parentTargetName];
796
- if (_typeof(target) === 'object') {
797
- if (!target['addChildAction']) {
798
- target['addChildAction'] = [child];
799
- } else if (!target['addChildAction'].includes(child)) {
800
- target['addChildAction'].push(child);
801
- }
802
- }
834
+ value: function markAddChild(tmodel, key, child) {
835
+ TargetUtil.markTargetChildAction(tmodel, key, child, "addChildAction");
803
836
  }
804
837
  }, {
805
838
  key: "markFetchAction",
806
839
  value: function markFetchAction(tmodel) {
807
- if (!tmodel) {
840
+ var key = TargetUtil.currentTargetName;
841
+ if (!(tmodel !== null && tmodel !== void 0 && tmodel.targets[key])) {
808
842
  return;
809
843
  }
810
- var currentTargetName = TargetUtil.currentTargetName;
811
- var target = tmodel.targets[currentTargetName];
812
- if (_typeof(target) === 'object') {
813
- target['fetchAction'] = true;
814
- if (!tmodel.fetchActionTargetList.includes(currentTargetName)) {
815
- tmodel.fetchActionTargetList.push(currentTargetName);
816
- }
844
+ if (!tmodel.fetchActionTargetList.includes(key)) {
845
+ tmodel.fetchActionTargetList.push(key);
817
846
  }
818
847
  }
848
+ }, {
849
+ key: "hasFetchAction",
850
+ value: function hasFetchAction(tmodel, key) {
851
+ return tmodel.fetchActionTargetList.includes(key);
852
+ }
819
853
  }, {
820
854
  key: "wrapTarget",
821
855
  value: function wrapTarget(tmodel, target, key) {
@@ -849,9 +883,9 @@ var TargetUtil = /*#__PURE__*/function () {
849
883
  value: function getOriginalNames(tmodel, key) {
850
884
  var originalTModel, originalTargetName;
851
885
  if (tmodel.isTargetImperative(key)) {
852
- var _tmodel$targetValues$6, _tmodel$targetValues$7;
853
- originalTModel = (_tmodel$targetValues$6 = tmodel.targetValues[key]) === null || _tmodel$targetValues$6 === void 0 ? void 0 : _tmodel$targetValues$6.originalTModel;
854
- originalTargetName = (_tmodel$targetValues$7 = tmodel.targetValues[key]) === null || _tmodel$targetValues$7 === void 0 ? void 0 : _tmodel$targetValues$7.originalTargetName;
886
+ var _tmodel$targetValues$7, _tmodel$targetValues$8;
887
+ originalTModel = (_tmodel$targetValues$7 = tmodel.targetValues[key]) === null || _tmodel$targetValues$7 === void 0 ? void 0 : _tmodel$targetValues$7.originalTModel;
888
+ originalTargetName = (_tmodel$targetValues$8 = tmodel.targetValues[key]) === null || _tmodel$targetValues$8 === void 0 ? void 0 : _tmodel$targetValues$8.originalTargetName;
855
889
  } else {
856
890
  var _tmodel$targets$key4, _tmodel$targets$key5;
857
891
  originalTModel = (_tmodel$targets$key4 = tmodel.targets[key]) === null || _tmodel$targets$key4 === void 0 ? void 0 : _tmodel$targets$key4.originalTModel;
@@ -925,6 +959,9 @@ var TargetUtil = /*#__PURE__*/function () {
925
959
  value: function resetTargetChildState(tmodel) {
926
960
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
927
961
  var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
962
+ if (tmodel.isLightweightChild) {
963
+ return;
964
+ }
928
965
  var sig = "".concat(tmodel.oid);
929
966
  if (visited.has(sig)) {
930
967
  return;
@@ -940,14 +977,15 @@ var TargetUtil = /*#__PURE__*/function () {
940
977
  }, {
941
978
  key: "resetTargetChildActions",
942
979
  value: function resetTargetChildActions(tmodel, key) {
980
+ var _targetValue$childAct, _targetValue$addChild;
943
981
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
944
982
  var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
945
- var target = tmodel.targets[key];
946
- if (!target) {
983
+ var targetValue = tmodel.targetValues[key];
984
+ if (!targetValue) {
947
985
  return;
948
986
  }
949
- var childActions = target.childAction ? _toConsumableArray(target.childAction) : [];
950
- var addChildActions = target.addChildAction ? _toConsumableArray(target.addChildAction) : [];
987
+ var childActions = _toConsumableArray((_targetValue$childAct = targetValue.childAction) !== null && _targetValue$childAct !== void 0 ? _targetValue$childAct : []);
988
+ var addChildActions = _toConsumableArray((_targetValue$addChild = targetValue.addChildAction) !== null && _targetValue$addChild !== void 0 ? _targetValue$addChild : []);
951
989
  childActions.forEach(function (child) {
952
990
  if (child) {
953
991
  TargetUtil.resetTargetChildState(child, options, visited);
@@ -959,11 +997,11 @@ var TargetUtil = /*#__PURE__*/function () {
959
997
  }
960
998
  });
961
999
  if (options.clearChildActions) {
962
- if (Array.isArray(target.childAction)) {
963
- target.childAction.length = 0;
1000
+ if (Array.isArray(targetValue.childAction)) {
1001
+ targetValue.childAction = [];
964
1002
  }
965
- if (Array.isArray(target.addChildAction)) {
966
- target.addChildAction.length = 0;
1003
+ if (Array.isArray(targetValue.addChildAction)) {
1004
+ targetValue.addChildAction = [];
967
1005
  }
968
1006
  }
969
1007
  }
@@ -981,8 +1019,8 @@ var TargetUtil = /*#__PURE__*/function () {
981
1019
  }
982
1020
  }
983
1021
  }, {
984
- key: "resetSingleTargetState",
985
- value: function resetSingleTargetState(tmodel, key) {
1022
+ key: "resetTargetStateOnly",
1023
+ value: function resetTargetStateOnly(tmodel, key) {
986
1024
  var _tmodel$targets$key6;
987
1025
  var targetValue = tmodel.targetValues[key];
988
1026
  var nextTarget = (_tmodel$targets$key6 = tmodel.targets[key]) === null || _tmodel$targets$key6 === void 0 ? void 0 : _tmodel$targets$key6.activateNextTarget;
@@ -995,15 +1033,38 @@ var TargetUtil = /*#__PURE__*/function () {
995
1033
  targetValue.resetFlag = true;
996
1034
  targetValue.nextTargetUpdateCount = 0;
997
1035
  targetValue.visibleCompleteSignature = undefined;
998
- targetValue.status = '';
1036
+ targetValue.status = "";
999
1037
  }
1000
- tmodel.cancelAnimation();
1001
- tmodel.activatedTargets.length = 0;
1002
1038
  tmodel.removeFromActiveTargets(key);
1003
1039
  tmodel.removeFromAnimatingMap(key);
1004
1040
  tmodel.removeFromUpdatingTargets(key);
1005
1041
  TargetUtil.clearPendingTarget(tmodel, key);
1006
1042
  }
1043
+ }, {
1044
+ key: "resetSingleTargetState",
1045
+ value: function resetSingleTargetState(tmodel, key) {
1046
+ TargetUtil.resetTargetStateOnly(tmodel, key);
1047
+ tmodel.cancelAnimation();
1048
+ tmodel.activatedTargets.length = 0;
1049
+ }
1050
+ }, {
1051
+ key: "resetRemovedChildTarget",
1052
+ value: function resetRemovedChildTarget(tmodel, key, child) {
1053
+ var targetValue = tmodel.targetValues[key];
1054
+ if (!targetValue) {
1055
+ return;
1056
+ }
1057
+ TargetUtil.resetTargetStateOnly(tmodel, key);
1058
+ for (var _i2 = 0, _arr2 = ["childAction", "addChildAction"]; _i2 < _arr2.length; _i2++) {
1059
+ var _children$indexOf;
1060
+ var name = _arr2[_i2];
1061
+ var children = targetValue[name];
1062
+ var index = (_children$indexOf = children === null || children === void 0 ? void 0 : children.indexOf(child)) !== null && _children$indexOf !== void 0 ? _children$indexOf : -1;
1063
+ if (index >= 0) {
1064
+ children.splice(index, 1);
1065
+ }
1066
+ }
1067
+ }
1007
1068
  }, {
1008
1069
  key: "convertAnimatingTargetsToUpdating",
1009
1070
  value: function convertAnimatingTargetsToUpdating(tmodels) {
@@ -1045,6 +1106,27 @@ var TargetUtil = /*#__PURE__*/function () {
1045
1106
  clearChildActions: reset === 'tree' || reset === 'all'
1046
1107
  };
1047
1108
  }
1109
+ }, {
1110
+ key: "isTargetUpdating",
1111
+ value: function isTargetUpdating(tmodel, key) {
1112
+ var targetValue = tmodel.targetValues[key];
1113
+ if (!targetValue) {
1114
+ return false;
1115
+ }
1116
+ var valuePointer = tmodel.getValueListPointer(key);
1117
+ var cycle = tmodel.getTargetCycle(key);
1118
+ var cycles = tmodel.getTargetCycles(key);
1119
+ var step = tmodel.getTargetStep(key);
1120
+ var steps = tmodel.getTargetSteps(key);
1121
+ if (Array.isArray(targetValue.valueList) && valuePointer < targetValue.valueList.length) {
1122
+ return true;
1123
+ } else if (tmodel.isTargetImperative(key) && cycle < cycles - 1) {
1124
+ return true;
1125
+ } else if (step < steps) {
1126
+ return true;
1127
+ }
1128
+ return false;
1129
+ }
1048
1130
  }]);
1049
1131
  }();
1050
1132
  export { TargetUtil };
@@ -68,7 +68,8 @@ var VisibilityUtil = /*#__PURE__*/function () {
68
68
  tmodel = parent;
69
69
  }
70
70
  var clip = VisibilityUtil.getScreenViewportRect();
71
- var isVisible = VisibilityUtil.rectsOverlap(rect, clip);
71
+ var verticalOnly = tmodel.type === "BI";
72
+ var isVisible = VisibilityUtil.rectsOverlap(rect, clip, verticalOnly);
72
73
  if (!isVisible) {
73
74
  return {
74
75
  clip: clip,
@@ -115,7 +116,8 @@ var VisibilityUtil = /*#__PURE__*/function () {
115
116
  }, {
116
117
  key: "rectsOverlap",
117
118
  value: function rectsOverlap(a, b) {
118
- return a.x <= b.r && a.r >= b.x && a.y <= b.b && a.b >= b.y;
119
+ var verticalOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
120
+ return (verticalOnly || a.x <= b.r && a.r >= b.x) && a.y <= b.b && a.b >= b.y;
119
121
  }
120
122
  }, {
121
123
  key: "intersectRects",
package/build/index.js CHANGED
@@ -20,6 +20,7 @@ export * from "./VisibilityUtil.js";
20
20
  export * from "./ScheduleUtil.js";
21
21
  export * from "./StateUtil.js";
22
22
  export * from "./ParticleTModel.js";
23
+ export * from "./ParticleChild.js";
23
24
  export * from "./ParticleRenderer.js";
24
25
  export * from "./ParticleRuntime.js";
25
26
  export * from "./ParticleUtil.js";