targetj 1.0.242 → 1.0.243

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
@@ -569,7 +569,7 @@ TargetJS.tApp.throttle = 0; // Slow down execution (milliseconds between cycles)
569
569
  TargetJS.tApp.debugLevel = 1; // Log cycle execution
570
570
  ```
571
571
  - Use `t(id)` in the browser console to find an object by its element id.
572
- - Use `t(id).bug()` to inspect all the vital properties.
572
+ - Use `t(id).debug()` to inspect all the vital properties.
573
573
  - Use `t(id).logTree()` to inspect the UI structure.
574
574
 
575
575
  ## Documentation
@@ -973,9 +973,7 @@ var BaseModel = /*#__PURE__*/function () {
973
973
  var _step2$value = _slicedToArray(_step2.value, 1),
974
974
  key = _step2$value[0];
975
975
  if (this.targetValues[key]) {
976
- this.targetValues[key].status = 'done';
977
- this.removeFromUpdatingTargets(key);
978
- this.removeFromActiveTargets(key);
976
+ this.addTargetToStatusList(key);
979
977
  }
980
978
  }
981
979
  } catch (err) {
@@ -51,6 +51,7 @@ var TModelManager = /*#__PURE__*/function () {
51
51
  this.preservedDomMap = {};
52
52
  this.targetMethodMap = {};
53
53
  this.noDomMap = {};
54
+ this.domPolicyMap = new Map();
54
55
  }
55
56
  }, {
56
57
  key: "clearFrameLists",
@@ -76,6 +77,7 @@ var TModelManager = /*#__PURE__*/function () {
76
77
  this.preservedDomMap = {};
77
78
  this.clearFrameLists();
78
79
  this.deleteDoms();
80
+ this.domPolicyMap.clear();
79
81
  }
80
82
  }, {
81
83
  key: "analyze",
@@ -166,15 +168,13 @@ var TModelManager = /*#__PURE__*/function () {
166
168
  activated.push(tmodel);
167
169
  }
168
170
  }
169
- if (visible || tmodel.requiresDom()) {
170
- if (tmodel.canHaveDom() && !tmodel.hasDom() && tmodel.isIncluded() && !this.noDomMap[tmodel.oid]) {
171
- var _tmodel$getDomHolder, _tmodel$getDomParent;
172
- if ((_tmodel$getDomHolder = tmodel.getDomHolder()) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists() || this.noDomMap[(_tmodel$getDomParent = tmodel.getDomParent()) === null || _tmodel$getDomParent === void 0 ? void 0 : _tmodel$getDomParent.oid]) {
173
- this.lists.noDom.push(tmodel);
174
- this.noDomMap[tmodel.oid] = true;
175
- } else {
176
- tmodel.markLayoutDirty('noDomHolder');
177
- }
171
+ if (this.shouldCreateDom(tmodel, visible) && !this.noDomMap[tmodel.oid]) {
172
+ var _tmodel$getDomHolder, _tmodel$getDomParent;
173
+ if ((_tmodel$getDomHolder = tmodel.getDomHolder()) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists() || this.noDomMap[(_tmodel$getDomParent = tmodel.getDomParent()) === null || _tmodel$getDomParent === void 0 ? void 0 : _tmodel$getDomParent.oid]) {
174
+ this.lists.noDom.push(tmodel);
175
+ this.noDomMap[tmodel.oid] = true;
176
+ } else {
177
+ tmodel.markLayoutDirty('noDomHolder');
178
178
  }
179
179
  }
180
180
  }
@@ -203,6 +203,9 @@ var TModelManager = /*#__PURE__*/function () {
203
203
  if (!tmodel.isIncluded()) {
204
204
  return false;
205
205
  }
206
+ if (this.getDomPolicy(tmodel) === "keep") {
207
+ return true;
208
+ }
206
209
  if (!tmodel.isVisible() && TUtil.isDefined(tmodel.targets.isVisible)) {
207
210
  return false;
208
211
  }
@@ -218,6 +221,38 @@ var TModelManager = /*#__PURE__*/function () {
218
221
  }
219
222
  return false;
220
223
  }
224
+ }, {
225
+ key: "shouldCreateDom",
226
+ value: function shouldCreateDom(tmodel, visible) {
227
+ if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.hasDom()) {
228
+ return false;
229
+ }
230
+ if (visible) {
231
+ return true;
232
+ }
233
+ if (tmodel.requiresDom()) {
234
+ return true;
235
+ }
236
+ return this.getDomPolicy(tmodel) === "keep";
237
+ }
238
+ }, {
239
+ key: "getDomPolicy",
240
+ value: function getDomPolicy(tmodel) {
241
+ if (this.domPolicyMap.has(tmodel.oid)) {
242
+ return this.domPolicyMap.get(tmodel.oid);
243
+ }
244
+ var current = tmodel;
245
+ while (current && current !== tRoot()) {
246
+ var policy = current.val("domPolicy");
247
+ if (TUtil.isDefined(policy)) {
248
+ this.domPolicyMap.set(tmodel.oid, policy);
249
+ return policy;
250
+ }
251
+ current = current.parent;
252
+ }
253
+ this.domPolicyMap.set(tmodel.oid, "auto");
254
+ return "auto";
255
+ }
221
256
  }, {
222
257
  key: "isBracketVisible",
223
258
  value: function isBracketVisible(tmodel) {
@@ -230,10 +230,14 @@ var TargetManager = /*#__PURE__*/function () {
230
230
  var valuePointer = tmodel.getValueListPointer(key);
231
231
  var cycle = tmodel.getTargetCycle(key);
232
232
  var cycles = tmodel.getTargetCycles(key);
233
+ var step = tmodel.getTargetStep(key);
234
+ var steps = tmodel.getTargetSteps(key);
233
235
  if (Array.isArray(targetValue.valueList) && valuePointer < targetValue.valueList.length) {
234
236
  return 'updating';
235
237
  } else if (tmodel.isTargetImperative(key) && cycle < cycles - 1) {
236
238
  return 'updating';
239
+ } else if (step < steps) {
240
+ return 'updating';
237
241
  } else if (tmodel.isTargetInLoop(key) || cycle < cycles - 1) {
238
242
  return 'active';
239
243
  } else {