targetj 1.0.259 → 1.1.0

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.
@@ -17,13 +17,14 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  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); }
19
19
  import { TUtil } from "./TUtil.js";
20
+ import { TModelFactory } from "./TModelFactory.js";
20
21
  var TMODEL_REF_KEY = "__targetjsTModelRef";
21
22
 
22
23
  /*
23
24
  * These fields are reconstructed separately or must be connected to the
24
25
  * current DOM rather than copied from the old tree.
25
26
  */
26
- var EXCLUDED_RUNTIME_FIELDS = new Set(["_state", "targets", "targetDefinitions", "restoringRuntime", "restoredUsesExistingDom", "type", "oid", "oidNum", "originalId", "parent", "allChildrenList", "allChildrenMap", "$dom", "viewport", "visibilityStatus", "currentStatus", "dirtyLayout", "originWindowEpoch", "hasDomNow", "isNowVisible", "domHeightTimestamp", "domWidthTimestamp", "lastBatch", "waapiBatch", "finalKeyframe", "finalRawFrame"]);
27
+ var EXCLUDED_RUNTIME_FIELDS = new Set(["_state", "targets", "targetDefinitions", "restoringRuntime", "restoredUsesExistingDom", "particleRenderer", "particleRuntime", "particleSyncPromise", "layoutCompleteWaiters", "isPrevTargetUpdated", "type", "oid", "oidNum", "originalId", "parent", "allChildrenList", "allChildrenMap", "$dom", "viewport", "visibilityStatus", "currentStatus", "dirtyLayout", "originWindowEpoch", "hasDomNow", "isNowVisible", "domHeightTimestamp", "domWidthTimestamp", "lastBatch", "waapiBatch", "finalKeyframe", "finalRawFrame"]);
27
28
  var CHILD_OPERATION_FIELDS = ["addedChildren", "deletedChildren", "movedChildren"];
28
29
  var RUNTIME_TIMESTAMP_FIELDS = new Set(["lastUpdate", "scheduleTimeStamp", "completeTime", "creationTime", "activationTime", "catchupAt", "startTime", "lastResizeHandledTime"]);
29
30
  var TARGET_RUNTIME_FIELDS = ["originalTargetName", "originalTModel", "invokerTargetName", "invokerTModel", "fetchAction", "childAction", "addChildAction"];
@@ -390,8 +391,9 @@ var StateUtil = /*#__PURE__*/function () {
390
391
  value: function exportRuntimeState(tmodel) {
391
392
  var fields = {};
392
393
  for (var _i8 = 0, _Object$keys4 = Object.keys(tmodel); _i8 < _Object$keys4.length; _i8++) {
394
+ var _tmodel$excludeRuntim;
393
395
  var key = _Object$keys4[_i8];
394
- if (EXCLUDED_RUNTIME_FIELDS.has(key)) {
396
+ if (EXCLUDED_RUNTIME_FIELDS.has(key) || (_tmodel$excludeRuntim = tmodel.excludeRuntimeSnapshotField) !== null && _tmodel$excludeRuntim !== void 0 && _tmodel$excludeRuntim.call(tmodel, key)) {
395
397
  continue;
396
398
  }
397
399
  fields[key] = tmodel[key];
@@ -406,6 +408,7 @@ var StateUtil = /*#__PURE__*/function () {
406
408
  }, {
407
409
  key: "importRuntimeState",
408
410
  value: function importRuntimeState(tmodel, runtime, tmodelIdMap) {
411
+ var _tmodel$restoreRuntim;
409
412
  var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
410
413
  _ref2$timeOffset = _ref2.timeOffset,
411
414
  timeOffset = _ref2$timeOffset === void 0 ? 0 : _ref2$timeOffset;
@@ -422,15 +425,7 @@ var StateUtil = /*#__PURE__*/function () {
422
425
  tmodel[key] = value;
423
426
  }
424
427
  StateUtil.clearMaterializedChildOperations(tmodel._state);
425
-
426
- /*
427
- * The child tree has already been reconstructed directly.
428
- */
429
428
  tmodel.childrenUpdateFlag = false;
430
-
431
- /*
432
- * DOM and Web Animation objects belong to the old runtime.
433
- */
434
429
  tmodel.$dom = null;
435
430
  tmodel.viewport = undefined;
436
431
  tmodel.hasDomNow = false;
@@ -438,20 +433,21 @@ var StateUtil = /*#__PURE__*/function () {
438
433
  tmodel.waapiBatch = undefined;
439
434
  tmodel.finalKeyframe = undefined;
440
435
  tmodel.finalRawFrame = undefined;
436
+ (_tmodel$restoreRuntim = tmodel.restoreRuntimeDerivedState) === null || _tmodel$restoreRuntim === void 0 || _tmodel$restoreRuntim.call(tmodel);
441
437
  return tmodel;
442
438
  }
443
439
  }, {
444
440
  key: "createRuntimeSnapshot",
445
441
  value: function createRuntimeSnapshot(tmodel) {
446
- var _tmodel$oidNum, _tmodel$targets, _tmodel$targets2, _tmodel$originalTarge;
447
- var children = _toConsumableArray(tmodel.getChildren());
442
+ var _tmodel$allChildrenLi, _tmodel$oidNum, _tmodel$targets, _tmodel$targets2, _tmodel$originalTarge;
443
+ var children = _toConsumableArray((_tmodel$allChildrenLi = tmodel.allChildrenList) !== null && _tmodel$allChildrenLi !== void 0 ? _tmodel$allChildrenLi : []);
448
444
  var targetDefinitions = TUtil.cloneTargetDefinition(tmodel.targetDefinitions);
449
445
  return {
450
446
  oid: tmodel.oid,
451
447
  oidNum: (_tmodel$oidNum = tmodel.oidNum) !== null && _tmodel$oidNum !== void 0 ? _tmodel$oidNum : 0,
452
448
  originalId: tmodel.originalId,
453
449
  type: tmodel.type,
454
- usesExistingDom: ((_tmodel$targets = tmodel.targets) === null || _tmodel$targets === void 0 ? void 0 : _tmodel$targets.domIsland) === true || ((_tmodel$targets2 = tmodel.targets) === null || _tmodel$targets2 === void 0 ? void 0 : _tmodel$targets2.reuseDomDefinition) === true || ((_tmodel$originalTarge = tmodel.originalTargetNames) === null || _tmodel$originalTarge === void 0 ? void 0 : _tmodel$originalTarge.includes('$dom')),
450
+ usesExistingDom: ((_tmodel$targets = tmodel.targets) === null || _tmodel$targets === void 0 ? void 0 : _tmodel$targets.domIsland) === true || ((_tmodel$targets2 = tmodel.targets) === null || _tmodel$targets2 === void 0 ? void 0 : _tmodel$targets2.reuseDomDefinition) === true || ((_tmodel$originalTarge = tmodel.originalTargetNames) === null || _tmodel$originalTarge === void 0 ? void 0 : _tmodel$originalTarge.includes("$dom")),
455
451
  targets: StateUtil.encodeValue(targetDefinitions),
456
452
  targetRuntime: StateUtil.exportTargetRuntime(tmodel),
457
453
  runtime: StateUtil.exportRuntimeState(tmodel),
@@ -468,10 +464,13 @@ var StateUtil = /*#__PURE__*/function () {
468
464
  throw new TypeError("A TModel constructor is required.");
469
465
  }
470
466
  var targets = StateUtil.encodeValue(snapshot.targets);
471
- var tmodel = new TModelClass(snapshot.type, targets, snapshot.oid, {
467
+ var options = {
472
468
  restoringRuntime: true,
473
469
  usesExistingDom: snapshot.usesExistingDom === true
474
- });
470
+ };
471
+ var tmodel = TModelFactory.create(snapshot.type, targets, function (type, targets, oid, options) {
472
+ return new TModelClass(type, targets, oid, options);
473
+ }, snapshot.oid, options);
475
474
  tmodel.type = snapshot.type;
476
475
  tmodel.oid = snapshot.oid;
477
476
  tmodel.oidNum = (_snapshot$oidNum = snapshot.oidNum) !== null && _snapshot$oidNum !== void 0 ? _snapshot$oidNum : 0;
package/build/TModel.js CHANGED
@@ -29,6 +29,7 @@ import { TargetUtil } from "./TargetUtil.js";
29
29
  import { TModelUtil } from "./TModelUtil.js";
30
30
  import { DomInit } from "./DomInit.js";
31
31
  import { StateUtil } from "./StateUtil.js";
32
+ import { TModelFactory } from "./TModelFactory.js";
32
33
 
33
34
  /**
34
35
  * It provides the base class for all objects in an app where targets are defined.
@@ -156,35 +157,35 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
156
157
  value: function addChild(child) {
157
158
  var _this2 = this;
158
159
  var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.length + this.allChildrenList.length;
159
- if (_typeof(child) === 'object') {
160
- this.childrenUpdateFlag = true;
161
- if (!(child instanceof TModel)) {
162
- var foundKey = Object.keys(this.actualValues).find(function (key) {
163
- return _this2.actualValues[key] === child;
164
- });
165
- var childDefinition = TUtil.cloneTargetDefinition(child);
166
- if (foundKey) {
167
- child = new TModel(childDefinition.id || foundKey, childDefinition);
168
- } else {
169
- child = new TModel("".concat(this.oid, "_"), childDefinition);
170
- }
160
+ if (!child || _typeof(child) !== 'object') {
161
+ return this;
162
+ }
163
+ if (!(child instanceof TModel)) {
164
+ var childDefinition = TUtil.cloneTargetDefinition(child);
165
+ var foundKey = Object.keys(this.actualValues).find(function (key) {
166
+ return _this2.actualValues[key] === child;
167
+ });
168
+ var type = foundKey ? childDefinition.id || foundKey : "".concat(this.oid, "_");
169
+ child = TModelFactory.create(type, childDefinition, function (type, targets) {
170
+ return new TModel(type, targets);
171
+ });
172
+ }
173
+ this.childrenUpdateFlag = true;
174
+ if (!child.toDiscard) {
175
+ App.tmodelIdMap[child.oid] = child;
176
+ this.addedChildren.push({
177
+ index: index,
178
+ child: child
179
+ });
180
+ child.parent = this;
181
+ child.markLayoutDirty('addChild');
182
+ if (child.updatingTargetList.length > 0) {
183
+ this.addToUpdatingChildren(child);
171
184
  }
172
- if (!child.toDiscard) {
173
- App.tmodelIdMap[child.oid] = child;
174
- this.addedChildren.push({
175
- index: index,
176
- child: child
177
- });
178
- child.parent = this;
179
- child.markLayoutDirty('addChild');
180
- if (child.updatingTargetList.length > 0) {
181
- this.addToUpdatingChildren(child);
182
- }
183
- if (child.activeTargetList.length > 0) {
184
- this.addToActiveChildren(child);
185
- }
186
- TargetUtil.markChildAction(this, TargetUtil.currentTargetName, child);
185
+ if (child.activeTargetList.length > 0) {
186
+ this.addToActiveChildren(child);
187
187
  }
188
+ TargetUtil.markChildAction(this, TargetUtil.currentTargetName, child);
188
189
  }
189
190
  return this;
190
191
  }
@@ -447,7 +448,7 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
447
448
  var hasDirtyEvent = this.hasEventDirty();
448
449
  var hasDom = this.hasDom();
449
450
  var visible = this.isVisible();
450
- var result = this.currentStatus === 'active' || hasDirtyLayout || visible && hasDirtyEvent || this.isNowVisible || hasDom && hasDirtyEvent;
451
+ var result = this.currentStatus === 'active' || this.visibilityDirty || hasDirtyLayout || visible && hasDirtyEvent || this.isNowVisible || hasDom && hasDirtyEvent;
451
452
  this.currentStatus = undefined;
452
453
  return result;
453
454
  }
@@ -1081,6 +1082,16 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
1081
1082
  var _ref14, _this$val16;
1082
1083
  return (_ref14 = (_this$val16 = this.val("paddingBottom")) !== null && _this$val16 !== void 0 ? _this$val16 : this.val("bottomPadding")) !== null && _ref14 !== void 0 ? _ref14 : TModelUtil.getPaddingValue(this, "bottom");
1083
1084
  }
1085
+ }, {
1086
+ key: "setLayoutX",
1087
+ value: function setLayoutX(value) {
1088
+ this.x = value;
1089
+ }
1090
+ }, {
1091
+ key: "setLayoutY",
1092
+ value: function setLayoutY(value) {
1093
+ this.y = value;
1094
+ }
1084
1095
  }, {
1085
1096
  key: "getWidth",
1086
1097
  value: function getWidth() {
@@ -1165,6 +1176,29 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
1165
1176
  value: function createRuntimeSnapshot() {
1166
1177
  return StateUtil.createRuntimeSnapshot(this);
1167
1178
  }
1179
+ }, {
1180
+ key: "handleSpecialTarget",
1181
+ value: function handleSpecialTarget() {
1182
+ return false;
1183
+ }
1184
+ }, {
1185
+ key: "handleSpecialTargetStep",
1186
+ value: function handleSpecialTargetStep() {
1187
+ return false;
1188
+ }
1189
+ }, {
1190
+ key: "handleSpecialTargetEnd",
1191
+ value: function handleSpecialTargetEnd() {
1192
+ return false;
1193
+ }
1194
+ }, {
1195
+ key: "finalizeChildrenTarget",
1196
+ value: function finalizeChildrenTarget() {
1197
+ return false;
1198
+ }
1199
+ }, {
1200
+ key: "onDomReady",
1201
+ value: function onDomReady() {}
1168
1202
  }]);
1169
1203
  }(BaseModel);
1170
1204
  export { TModel };
@@ -0,0 +1,48 @@
1
+ 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); }
2
+ 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; } } }; }
3
+ 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; } }
4
+ 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; }
5
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
6
+ 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); } }
7
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
+ 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); }
11
+ var TModelFactory = /*#__PURE__*/function () {
12
+ function TModelFactory() {
13
+ _classCallCheck(this, TModelFactory);
14
+ }
15
+ return _createClass(TModelFactory, null, [{
16
+ key: "register",
17
+ value: function register(match, create) {
18
+ TModelFactory.factories.push({
19
+ match: match,
20
+ create: create
21
+ });
22
+ }
23
+ }, {
24
+ key: "create",
25
+ value: function create(type, targets, defaultCreator) {
26
+ for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
27
+ args[_key - 3] = arguments[_key];
28
+ }
29
+ var _iterator = _createForOfIteratorHelper(this.factories),
30
+ _step;
31
+ try {
32
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
33
+ var entry = _step.value;
34
+ if (entry.match(targets)) {
35
+ return entry.create.apply(entry, [type, targets].concat(args));
36
+ }
37
+ }
38
+ } catch (err) {
39
+ _iterator.e(err);
40
+ } finally {
41
+ _iterator.f();
42
+ }
43
+ return defaultCreator.apply(void 0, [type, targets].concat(args));
44
+ }
45
+ }]);
46
+ }();
47
+ _defineProperty(TModelFactory, "factories", []);
48
+ export { TModelFactory };
@@ -20,6 +20,7 @@ import { getLocationManager, getEvents, getTargetManager, tRoot } from "./App.js
20
20
  import { TModelUtil } from "./TModelUtil.js";
21
21
  import { TargetUtil } from "./TargetUtil.js";
22
22
  import { AnimationUtil } from "./AnimationUtil.js";
23
+ import { TargetData } from "./TargetData.js";
23
24
 
24
25
  /**
25
26
  * It analyzes all objects and based on their needs, creates or removes DOM elements, restyles objects, and rerenders them.
@@ -44,6 +45,7 @@ var TModelManager = /*#__PURE__*/function () {
44
45
  noDom: [],
45
46
  updatingTModels: [],
46
47
  activeTModels: [],
48
+ noDomVisibilityTModels: [],
47
49
  updatingTargets: [],
48
50
  activeTargets: []
49
51
  };
@@ -66,6 +68,7 @@ var TModelManager = /*#__PURE__*/function () {
66
68
  this.lists.noDom.length = 0;
67
69
  this.lists.updatingTModels.length = 0;
68
70
  this.lists.activeTModels.length = 0;
71
+ this.lists.noDomVisibilityTModels.length = 0;
69
72
  this.lists.updatingTargets.length = 0;
70
73
  this.lists.activeTargets.length = 0;
71
74
  this.targetMethodMap = {};
@@ -92,93 +95,116 @@ var TModelManager = /*#__PURE__*/function () {
92
95
  var _iterator = _createForOfIteratorHelper(getLocationManager().hasLocationList),
93
96
  _step;
94
97
  try {
95
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
- var tmodel = _step.value;
97
- lastVisibleMap[tmodel.oid] = undefined;
98
- lastPreservedMap[tmodel.oid] = undefined;
99
- if (!tmodel.exists()) {
100
- if (tmodel.hasDom()) {
101
- this.addToDeletedDom(tmodel);
102
- }
103
- delete this.visibleOidMap[tmodel.oid];
104
- delete this.preservedDomMap[tmodel.oid];
105
- continue;
106
- }
107
- var visible = tmodel.isVisible();
108
- if (visible && tmodel.isIncluded()) {
109
- this.visibleOidMap[tmodel.oid] = tmodel;
110
- delete this.preservedDomMap[tmodel.oid];
111
- this.lists.visible.push(tmodel);
112
- } else {
113
- delete this.visibleOidMap[tmodel.oid];
114
- }
115
- var preserveDom = this.shouldPreserveDom(tmodel);
116
- if (!visible && preserveDom && tmodel.hasDom()) {
117
- this.preservedDomMap[tmodel.oid] = tmodel;
118
- } else {
119
- delete this.preservedDomMap[tmodel.oid];
120
- }
121
- if (tmodel.hasDom()) {
122
- if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
123
- this.addToDeletedDom(tmodel);
124
- tmodel.getChildren().forEach(function (tmodel) {
125
- if (!tmodel.managesOwnScroll()) {
126
- _this.addToRecursiveDeletedDom(tmodel);
127
- }
128
- });
129
- }
130
- }
131
- if (visible || tmodel.isActivated()) {
132
- var _state$updatingTarget, _state$activeTargetLi;
133
- var state = tmodel.state();
134
- if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
135
- this.lists.updatingTModels.push(tmodel);
136
- this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
137
- }
138
- if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
139
- this.lists.activeTModels.push(tmodel);
140
- this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
98
+ var _loop = function _loop() {
99
+ var _tmodel$noDomUpdating;
100
+ var tmodel = _step.value;
101
+ if (tmodel.isLightweightChild) {
102
+ delete lastVisibleMap[tmodel.oid];
103
+ delete lastPreservedMap[tmodel.oid];
104
+ delete _this.visibleOidMap[tmodel.oid];
105
+ delete _this.preservedDomMap[tmodel.oid];
106
+ _this.domPolicyMap.delete(tmodel.oid);
107
+ return 0; // continue
141
108
  }
142
- }
143
- if (preserveDom && !visible && !tmodel.isActivated()) {
144
- if (this.needsRestyle(tmodel)) {
145
- this.lists.restyle.push(tmodel);
109
+ lastVisibleMap[tmodel.oid] = undefined;
110
+ lastPreservedMap[tmodel.oid] = undefined;
111
+ if (!tmodel.exists()) {
112
+ if (tmodel.hasDom()) {
113
+ _this.addToDeletedDom(tmodel);
114
+ }
115
+ delete _this.visibleOidMap[tmodel.oid];
116
+ delete _this.preservedDomMap[tmodel.oid];
117
+ return 0; // continue
146
118
  }
147
- }
148
- if (visible || tmodel.isActivated()) {
149
- if (this.needsRerender(tmodel)) {
150
- this.lists.rerender.push(tmodel);
119
+ var visible = tmodel.isVisible();
120
+ if (!visible && (_tmodel$noDomUpdating = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating !== void 0 && _tmodel$noDomUpdating.size && _toConsumableArray(tmodel.noDomUpdatingTargets).some(function (key) {
121
+ var targetValue = tmodel.targetValues[key];
122
+ return TargetData.affectsVisibility(key) && (targetValue === null || targetValue === void 0 ? void 0 : targetValue.catchupAt) !== undefined;
123
+ })) {
124
+ _this.lists.noDomVisibilityTModels.push(tmodel);
151
125
  }
152
- if (this.needsRestyle(tmodel)) {
153
- this.lists.restyle.push(tmodel);
126
+ if (visible && tmodel.isIncluded()) {
127
+ _this.visibleOidMap[tmodel.oid] = tmodel;
128
+ delete _this.preservedDomMap[tmodel.oid];
129
+ _this.lists.visible.push(tmodel);
130
+ } else {
131
+ delete _this.visibleOidMap[tmodel.oid];
154
132
  }
155
- if (this.needsReasyncStyle(tmodel)) {
156
- this.lists.reasyncStyle.push(tmodel);
133
+ var preserveDom = _this.shouldPreserveDom(tmodel);
134
+ if (!visible && preserveDom && tmodel.hasDom()) {
135
+ _this.preservedDomMap[tmodel.oid] = tmodel;
136
+ } else {
137
+ delete _this.preservedDomMap[tmodel.oid];
157
138
  }
158
- if (this.needsReattach(tmodel)) {
159
- this.lists.reattach.push(tmodel);
139
+ if (tmodel.hasDom()) {
140
+ if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
141
+ _this.addToDeletedDom(tmodel);
142
+ tmodel.getChildren().forEach(function (child) {
143
+ if (child.isLightweightChild) {
144
+ return;
145
+ }
146
+ if (!child.managesOwnScroll()) {
147
+ _this.addToRecursiveDeletedDom(child);
148
+ }
149
+ });
150
+ }
160
151
  }
161
- if (this.needsRelocation(tmodel)) {
162
- this.lists.relocation.push(tmodel);
152
+ if (visible || tmodel.isActivated()) {
153
+ var _state$updatingTarget, _state$activeTargetLi;
154
+ var state = tmodel.state();
155
+ if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
156
+ _this.lists.updatingTModels.push(tmodel);
157
+ _this.lists.updatingTargets = [].concat(_toConsumableArray(_this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
158
+ }
159
+ if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
160
+ _this.lists.activeTModels.push(tmodel);
161
+ _this.lists.activeTargets = [].concat(_toConsumableArray(_this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
162
+ }
163
163
  }
164
- var _state = tmodel.state();
165
- if (_state.targetMethodMap && Object.keys(_state.targetMethodMap).length > 0) {
166
- this.targetMethodMap[tmodel.oid] = _objectSpread({}, _state.targetMethodMap);
167
- _state.targetMethodMap = {};
164
+ if (preserveDom && !visible && !tmodel.isActivated()) {
165
+ if (_this.needsRestyle(tmodel)) {
166
+ _this.lists.restyle.push(tmodel);
167
+ }
168
168
  }
169
- if (tmodel.isActivated()) {
170
- activated.push(tmodel);
169
+ if (visible || tmodel.isActivated()) {
170
+ if (_this.needsRerender(tmodel)) {
171
+ _this.lists.rerender.push(tmodel);
172
+ }
173
+ if (_this.needsRestyle(tmodel)) {
174
+ _this.lists.restyle.push(tmodel);
175
+ }
176
+ if (_this.needsReasyncStyle(tmodel)) {
177
+ _this.lists.reasyncStyle.push(tmodel);
178
+ }
179
+ if (_this.needsReattach(tmodel)) {
180
+ _this.lists.reattach.push(tmodel);
181
+ }
182
+ if (_this.needsRelocation(tmodel)) {
183
+ _this.lists.relocation.push(tmodel);
184
+ }
185
+ var _state = tmodel.state();
186
+ if (_state.targetMethodMap && Object.keys(_state.targetMethodMap).length > 0) {
187
+ _this.targetMethodMap[tmodel.oid] = _objectSpread({}, _state.targetMethodMap);
188
+ _state.targetMethodMap = {};
189
+ }
190
+ if (tmodel.isActivated()) {
191
+ activated.push(tmodel);
192
+ }
171
193
  }
172
- }
173
- if (this.shouldCreateDom(tmodel, visible) && !this.noDomMap[tmodel.oid]) {
174
- var _tmodel$getDomHolder, _tmodel$getDomParent;
175
- 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]) {
176
- this.lists.noDom.push(tmodel);
177
- this.noDomMap[tmodel.oid] = true;
178
- } else {
179
- tmodel.markLayoutDirty('noDomHolder');
194
+ if (_this.shouldCreateDom(tmodel, visible) && !_this.noDomMap[tmodel.oid]) {
195
+ var _tmodel$getDomHolder, _tmodel$getDomParent;
196
+ 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]) {
197
+ _this.lists.noDom.push(tmodel);
198
+ _this.noDomMap[tmodel.oid] = true;
199
+ } else {
200
+ tmodel.markLayoutDirty('noDomHolder');
201
+ }
180
202
  }
181
- }
203
+ },
204
+ _ret;
205
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
206
+ _ret = _loop();
207
+ if (_ret === 0) continue;
182
208
  }
183
209
  } catch (err) {
184
210
  _iterator.e(err);
@@ -284,15 +310,18 @@ var TModelManager = /*#__PURE__*/function () {
284
310
  key: "addToRecursiveDeletedDom",
285
311
  value: function addToRecursiveDeletedDom(tmodel) {
286
312
  var _this2 = this;
313
+ if (tmodel.isLightweightChild) {
314
+ return;
315
+ }
287
316
  delete this.visibleOidMap[tmodel.oid];
288
317
  delete this.preservedDomMap[tmodel.oid];
289
318
  if (!this.lists.deletedDom.includes(tmodel)) {
290
319
  if (tmodel.hasDom()) {
291
320
  this.lists.deletedDom.push(tmodel);
292
321
  }
293
- tmodel.getChildren().forEach(function (tmodel) {
294
- if (!tmodel.managesOwnScroll()) {
295
- _this2.addToRecursiveDeletedDom(tmodel);
322
+ tmodel.getChildren().forEach(function (child) {
323
+ if (!child.isLightweightChild && !child.managesOwnScroll()) {
324
+ _this2.addToRecursiveDeletedDom(child);
296
325
  }
297
326
  });
298
327
  }
@@ -336,6 +365,9 @@ var TModelManager = /*#__PURE__*/function () {
336
365
  }, {
337
366
  key: "addDeletedTree",
338
367
  value: function addDeletedTree(tmodel) {
368
+ if (tmodel.isLightweightChild) {
369
+ return;
370
+ }
339
371
  delete this.visibleOidMap[tmodel.oid];
340
372
  delete this.preservedDomMap[tmodel.oid];
341
373
  this.domPolicyMap.delete(tmodel.oid);
@@ -347,7 +379,9 @@ var TModelManager = /*#__PURE__*/function () {
347
379
  try {
348
380
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
349
381
  var child = _step3.value;
350
- this.addDeletedTree(child);
382
+ if (!child.isLightweightChild) {
383
+ this.addDeletedTree(child);
384
+ }
351
385
  }
352
386
  } catch (err) {
353
387
  _iterator3.e(err);
@@ -618,12 +652,20 @@ var TModelManager = /*#__PURE__*/function () {
618
652
  }, {
619
653
  key: "catchupNoDomTargetsBeforeStyle",
620
654
  value: function catchupNoDomTargetsBeforeStyle(tmodel) {
621
- var _tmodel$noDomUpdating;
622
- if (!((_tmodel$noDomUpdating = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating !== void 0 && _tmodel$noDomUpdating.size)) {
655
+ var _tmodel$noDomUpdating2;
656
+ if (!((_tmodel$noDomUpdating2 = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating2 !== void 0 && _tmodel$noDomUpdating2.size)) {
623
657
  return;
624
658
  }
625
659
  for (var _i4 = 0, _arr3 = _toConsumableArray(tmodel.noDomUpdatingTargets); _i4 < _arr3.length; _i4++) {
626
660
  var key = _arr3[_i4];
661
+ var targetValue = tmodel.targetValues[key];
662
+ if (!targetValue) {
663
+ continue;
664
+ }
665
+ getTargetManager().catchupTargetByElapsed(tmodel, key, {
666
+ fireEnd: false
667
+ });
668
+ delete targetValue.catchupAt;
627
669
  var newStatus = getTargetManager().calculateTargetStatus(tmodel, key);
628
670
  tmodel.setTargetStatus(key, newStatus);
629
671
  }
@@ -646,26 +688,26 @@ var TModelManager = /*#__PURE__*/function () {
646
688
  _step11;
647
689
  try {
648
690
  for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
649
- var _tmodel3$domId;
650
- var _tmodel3 = _step11.value;
651
- var domId = (_tmodel3$domId = _tmodel3.domId) !== null && _tmodel3$domId !== void 0 ? _tmodel3$domId : _tmodel3.oid;
691
+ var _tmodel4$domId;
692
+ var _tmodel4 = _step11.value;
693
+ var domId = (_tmodel4$domId = _tmodel4.domId) !== null && _tmodel4$domId !== void 0 ? _tmodel4$domId : _tmodel4.oid;
652
694
  if ($Dom.query("#".concat(domId))) {
653
- _tmodel3.$dom = new $Dom("#".concat(domId));
654
- _tmodel3.$dom.attr('tgjs', 'true');
655
- _tmodel3.hasDomNow = true;
656
- _tmodel3.markLayoutDirty('hasDomNow');
657
- attached.push(_tmodel3);
658
- if (this.needsRerender(_tmodel3)) {
659
- this.lists.rerender.push(_tmodel3);
695
+ _tmodel4.$dom = new $Dom("#".concat(domId));
696
+ _tmodel4.$dom.attr('tgjs', 'true');
697
+ _tmodel4.hasDomNow = true;
698
+ _tmodel4.markLayoutDirty('hasDomNow');
699
+ attached.push(_tmodel4);
700
+ if (this.needsRerender(_tmodel4)) {
701
+ this.lists.rerender.push(_tmodel4);
660
702
  }
661
- if (this.needsRestyle(_tmodel3)) {
662
- this.lists.restyle.push(_tmodel3);
703
+ if (this.needsRestyle(_tmodel4)) {
704
+ this.lists.restyle.push(_tmodel4);
663
705
  }
664
- if (this.needsReasyncStyle(_tmodel3)) {
665
- this.lists.reasyncStyle.push(_tmodel3);
706
+ if (this.needsReasyncStyle(_tmodel4)) {
707
+ this.lists.reasyncStyle.push(_tmodel4);
666
708
  }
667
709
  } else {
668
- needsDom.push(_tmodel3);
710
+ needsDom.push(_tmodel4);
669
711
  }
670
712
  }
671
713
  } catch (err) {
@@ -723,16 +765,22 @@ var TModelManager = /*#__PURE__*/function () {
723
765
  var _tmodel = _attached[_i6];
724
766
  this.catchupNoDomTargetsBeforeStyle(_tmodel);
725
767
  }
768
+ var domReady = [];
726
769
  for (var _i7 = 0, _styleBatch = styleBatch; _i7 < _styleBatch.length; _i7++) {
727
770
  var _tmodel2 = _styleBatch[_i7];
728
771
  if (_tmodel2.hasDom()) {
729
772
  _tmodel2.hasDomNow = true;
730
773
  _tmodel2.markLayoutDirty('hasDomNow');
774
+ domReady.push(_tmodel2);
731
775
  }
732
776
  TModelUtil.initStyleMaps(_tmodel2);
733
777
  TModelUtil.fixStyle(_tmodel2);
734
778
  TModelUtil.fixAsyncStyle(_tmodel2);
735
779
  }
780
+ for (var _i8 = 0, _domReady = domReady; _i8 < _domReady.length; _i8++) {
781
+ var _tmodel3 = _domReady[_i8];
782
+ _tmodel3.onDomReady();
783
+ }
736
784
  this.activatePendingTargetsAfterDom(attached);
737
785
  getEvents().attachEvents(attached.filter(function (t) {
738
786
  var _t$externalEventMap;