targetj 1.0.258 → 1.0.260

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,6 +17,7 @@ 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
  /*
@@ -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
  }
@@ -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 };
@@ -94,6 +94,14 @@ var TModelManager = /*#__PURE__*/function () {
94
94
  try {
95
95
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
96
  var tmodel = _step.value;
97
+ if (tmodel.isLightweightChild) {
98
+ delete lastVisibleMap[tmodel.oid];
99
+ delete lastPreservedMap[tmodel.oid];
100
+ delete this.visibleOidMap[tmodel.oid];
101
+ delete this.preservedDomMap[tmodel.oid];
102
+ this.domPolicyMap.delete(tmodel.oid);
103
+ continue;
104
+ }
97
105
  lastVisibleMap[tmodel.oid] = undefined;
98
106
  lastPreservedMap[tmodel.oid] = undefined;
99
107
  if (!tmodel.exists()) {
@@ -121,9 +129,12 @@ var TModelManager = /*#__PURE__*/function () {
121
129
  if (tmodel.hasDom()) {
122
130
  if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
123
131
  this.addToDeletedDom(tmodel);
124
- tmodel.getChildren().forEach(function (tmodel) {
125
- if (!tmodel.managesOwnScroll()) {
126
- _this.addToRecursiveDeletedDom(tmodel);
132
+ tmodel.getChildren().forEach(function (child) {
133
+ if (child.isLightweightChild) {
134
+ return;
135
+ }
136
+ if (!child.managesOwnScroll()) {
137
+ _this.addToRecursiveDeletedDom(child);
127
138
  }
128
139
  });
129
140
  }
@@ -284,15 +295,18 @@ var TModelManager = /*#__PURE__*/function () {
284
295
  key: "addToRecursiveDeletedDom",
285
296
  value: function addToRecursiveDeletedDom(tmodel) {
286
297
  var _this2 = this;
298
+ if (tmodel.isLightweightChild) {
299
+ return;
300
+ }
287
301
  delete this.visibleOidMap[tmodel.oid];
288
302
  delete this.preservedDomMap[tmodel.oid];
289
303
  if (!this.lists.deletedDom.includes(tmodel)) {
290
304
  if (tmodel.hasDom()) {
291
305
  this.lists.deletedDom.push(tmodel);
292
306
  }
293
- tmodel.getChildren().forEach(function (tmodel) {
294
- if (!tmodel.managesOwnScroll()) {
295
- _this2.addToRecursiveDeletedDom(tmodel);
307
+ tmodel.getChildren().forEach(function (child) {
308
+ if (!child.isLightweightChild && !child.managesOwnScroll()) {
309
+ _this2.addToRecursiveDeletedDom(child);
296
310
  }
297
311
  });
298
312
  }
@@ -336,6 +350,9 @@ var TModelManager = /*#__PURE__*/function () {
336
350
  }, {
337
351
  key: "addDeletedTree",
338
352
  value: function addDeletedTree(tmodel) {
353
+ if (tmodel.isLightweightChild) {
354
+ return;
355
+ }
339
356
  delete this.visibleOidMap[tmodel.oid];
340
357
  delete this.preservedDomMap[tmodel.oid];
341
358
  this.domPolicyMap.delete(tmodel.oid);
@@ -347,7 +364,9 @@ var TModelManager = /*#__PURE__*/function () {
347
364
  try {
348
365
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
349
366
  var child = _step3.value;
350
- this.addDeletedTree(child);
367
+ if (!child.isLightweightChild) {
368
+ this.addDeletedTree(child);
369
+ }
351
370
  }
352
371
  } catch (err) {
353
372
  _iterator3.e(err);
@@ -624,6 +643,14 @@ var TModelManager = /*#__PURE__*/function () {
624
643
  }
625
644
  for (var _i4 = 0, _arr3 = _toConsumableArray(tmodel.noDomUpdatingTargets); _i4 < _arr3.length; _i4++) {
626
645
  var key = _arr3[_i4];
646
+ var targetValue = tmodel.targetValues[key];
647
+ if (!targetValue) {
648
+ continue;
649
+ }
650
+ getTargetManager().catchupTargetByElapsed(tmodel, key, {
651
+ fireEnd: false
652
+ });
653
+ delete targetValue.catchupAt;
627
654
  var newStatus = getTargetManager().calculateTargetStatus(tmodel, key);
628
655
  tmodel.setTargetStatus(key, newStatus);
629
656
  }
@@ -646,26 +673,26 @@ var TModelManager = /*#__PURE__*/function () {
646
673
  _step11;
647
674
  try {
648
675
  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;
676
+ var _tmodel4$domId;
677
+ var _tmodel4 = _step11.value;
678
+ var domId = (_tmodel4$domId = _tmodel4.domId) !== null && _tmodel4$domId !== void 0 ? _tmodel4$domId : _tmodel4.oid;
652
679
  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);
680
+ _tmodel4.$dom = new $Dom("#".concat(domId));
681
+ _tmodel4.$dom.attr('tgjs', 'true');
682
+ _tmodel4.hasDomNow = true;
683
+ _tmodel4.markLayoutDirty('hasDomNow');
684
+ attached.push(_tmodel4);
685
+ if (this.needsRerender(_tmodel4)) {
686
+ this.lists.rerender.push(_tmodel4);
660
687
  }
661
- if (this.needsRestyle(_tmodel3)) {
662
- this.lists.restyle.push(_tmodel3);
688
+ if (this.needsRestyle(_tmodel4)) {
689
+ this.lists.restyle.push(_tmodel4);
663
690
  }
664
- if (this.needsReasyncStyle(_tmodel3)) {
665
- this.lists.reasyncStyle.push(_tmodel3);
691
+ if (this.needsReasyncStyle(_tmodel4)) {
692
+ this.lists.reasyncStyle.push(_tmodel4);
666
693
  }
667
694
  } else {
668
- needsDom.push(_tmodel3);
695
+ needsDom.push(_tmodel4);
669
696
  }
670
697
  }
671
698
  } catch (err) {
@@ -723,16 +750,22 @@ var TModelManager = /*#__PURE__*/function () {
723
750
  var _tmodel = _attached[_i6];
724
751
  this.catchupNoDomTargetsBeforeStyle(_tmodel);
725
752
  }
753
+ var domReady = [];
726
754
  for (var _i7 = 0, _styleBatch = styleBatch; _i7 < _styleBatch.length; _i7++) {
727
755
  var _tmodel2 = _styleBatch[_i7];
728
756
  if (_tmodel2.hasDom()) {
729
757
  _tmodel2.hasDomNow = true;
730
758
  _tmodel2.markLayoutDirty('hasDomNow');
759
+ domReady.push(_tmodel2);
731
760
  }
732
761
  TModelUtil.initStyleMaps(_tmodel2);
733
762
  TModelUtil.fixStyle(_tmodel2);
734
763
  TModelUtil.fixAsyncStyle(_tmodel2);
735
764
  }
765
+ for (var _i8 = 0, _domReady = domReady; _i8 < _domReady.length; _i8++) {
766
+ var _tmodel3 = _domReady[_i8];
767
+ _tmodel3.onDomReady();
768
+ }
736
769
  this.activatePendingTargetsAfterDom(attached);
737
770
  getEvents().attachEvents(attached.filter(function (t) {
738
771
  var _t$externalEventMap;
package/build/TUtil.js CHANGED
@@ -237,14 +237,19 @@ var TUtil = /*#__PURE__*/function () {
237
237
  }, {
238
238
  key: "runTargetValue",
239
239
  value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
240
+ var instance = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
240
241
  var cleanKey = TargetUtil.getTargetName(key);
241
242
  var isExternalEvent = TargetData.allEventMap[cleanKey];
243
+ var instanceArgs = TUtil.isDefined(instance) ? [instance] : [];
242
244
  if (isExternalEvent) {
243
- return typeof target.value === 'function' ? target.value.call(tmodel, getEvents().getCurrentOriginalEvent(), cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
245
+ var _target$value;
246
+ return typeof target.value === 'function' ? (_target$value = target.value).call.apply(_target$value, [tmodel].concat(instanceArgs, [getEvents().getCurrentOriginalEvent(), cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
244
247
  } else if (tmodel.val("___".concat(key))) {
245
- return typeof target.value === 'function' ? target.value.call(tmodel, tmodel.val("___".concat(key)), cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
248
+ var _target$value2;
249
+ return typeof target.value === 'function' ? (_target$value2 = target.value).call.apply(_target$value2, [tmodel].concat(instanceArgs, [tmodel.val("___".concat(key)), cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
246
250
  } else {
247
- return typeof target.value === 'function' ? target.value.call(tmodel, cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
251
+ var _target$value3;
252
+ return typeof target.value === 'function' ? (_target$value3 = target.value).call.apply(_target$value3, [tmodel].concat(instanceArgs, [cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
248
253
  }
249
254
  }
250
255
  }, {
@@ -235,7 +235,7 @@ _defineProperty(TargetData, "attributeTargetMap", {
235
235
  minLength: true,
236
236
  max: true,
237
237
  min: true,
238
- readonly: true,
238
+ readOnly: true,
239
239
  required: true,
240
240
  alt: true,
241
241
  disabled: true,
@@ -708,7 +708,7 @@ _defineProperty(TargetData, "attributesToTargets", {
708
708
  oninput: 'onInput',
709
709
  onsubmit: 'onSubmit',
710
710
  onvisible: 'onVisible',
711
- oninvisible: 'oInVisible',
711
+ oninvisible: 'oInvisible',
712
712
  onresize: 'onResize',
713
713
  textalign: 'textAlign',
714
714
  preventdefault: 'preventDefault',
@@ -811,7 +811,7 @@ _defineProperty(TargetData, "internalEventMap", {
811
811
  onVisible: function onVisible(tmodel) {
812
812
  return tmodel.isNowVisible;
813
813
  },
814
- onInVisible: function onInVisible(tmodel) {
814
+ onInvisible: function onInvisible(tmodel) {
815
815
  return tmodel.isNowInvisible;
816
816
  },
817
817
  onResize: function onResize(tmodel) {
@@ -923,6 +923,6 @@ _defineProperty(TargetData, "lifecyclePatterns", {
923
923
  });
924
924
  _defineProperty(TargetData, "eventSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)))));
925
925
  _defineProperty(TargetData, "styleSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.styleTargetMap)), _toConsumableArray(Object.keys(_TargetData.asyncStyleTargetMap)), _toConsumableArray(Object.keys(_TargetData.attributeTargetMap)))));
926
- _defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), _toConsumableArray(Object.keys(_TargetData.mustExecuteTargets)), ['html', 'isInFlow', 'domHolder', 'domParent', 'gap', 'widthFromDom', 'heightFromDom', 'requiresDom', 'preventDefault', 'canDeleteDom', 'textOnly', 'styling', '$dom', 'defaultStyling', 'reuseDomDefinition', 'canHaveDom', 'excludeXYCalc', 'excludeX', 'excludeY', 'containerOverflowMode', 'itemOverflowMode', 'baseElement', 'element', 'otype', 'calculateChildren', 'domIsland', 'bracketThreshold', 'bracketSize', 'shouldBeBracketed', 'sourceDom'])));
926
+ _defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), _toConsumableArray(Object.keys(_TargetData.mustExecuteTargets)), ['children', 'addChildren', 'addParticles', 'html', 'isInFlow', 'domHolder', 'domParent', 'gap', 'widthFromDom', 'heightFromDom', 'requiresDom', 'preventDefault', 'canDeleteDom', 'textOnly', 'styling', '$dom', 'defaultStyling', 'reuseDomDefinition', 'canHaveDom', 'excludeXYCalc', 'excludeX', 'excludeY', 'containerOverflowMode', 'itemOverflowMode', 'baseElement', 'element', 'otype', 'calculateChildren', 'domIsland', 'bracketThreshold', 'bracketSize', 'shouldBeBracketed', 'sourceDom'])));
927
927
  _defineProperty(TargetData, "activationKeywordSet", new Set(['originalTModel', 'originalTargetName', 'activateNextTarget']));
928
928
  export { TargetData };
@@ -25,6 +25,7 @@ import { TUtil } from "./TUtil.js";
25
25
  import { AnimationUtil } from "./AnimationUtil.js";
26
26
  import { Easing } from "./Easing.js";
27
27
  import { getLoader, getRunScheduler, getAnimationManager } from "./App.js";
28
+ import { TModelFactory } from "./TModelFactory.js";
28
29
 
29
30
  /**
30
31
  * It is responsible for executing both declarative and imperative targets.
@@ -315,7 +316,23 @@ var TargetExecutor = /*#__PURE__*/function () {
315
316
  return;
316
317
  }
317
318
  var targetInitial = !tmodel.targetValues[key] && TUtil.isDefined(tmodel.targets[key].initialValue) ? tmodel.targets[key].initialValue : undefined;
318
- var valueArray = TargetParser.getValueStepsCycles(tmodel, key, tmodel.targets[key], cycle);
319
+ var target = tmodel.targets[key];
320
+ var hasInstances = target && _typeof(target) === 'object' && TUtil.isDefined(target.instances);
321
+ var instances = hasInstances ? TargetParser.getTargetInstances(tmodel, key, target, cycle) : 1;
322
+ var valueArray;
323
+ if (hasInstances) {
324
+ var values = new Array(instances);
325
+ valueArray = TargetParser.getValueStepsCycles(tmodel, key, target, cycle, 0);
326
+ values[0] = valueArray[0];
327
+ valueArray[0] = values;
328
+ var lastValues = tmodel.val(key);
329
+ for (var instance = 1; instance < instances; instance++) {
330
+ var lastValue = Array.isArray(lastValues) ? lastValues[instance] : lastValues;
331
+ values[instance] = TargetParser.getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance);
332
+ }
333
+ } else {
334
+ valueArray = TargetParser.getValueStepsCycles(tmodel, key, target, cycle);
335
+ }
319
336
  var newValue = valueArray[0];
320
337
  var newSteps = valueArray[1] || 0;
321
338
  var newInterval = valueArray[2] || 0;
@@ -324,20 +341,42 @@ var TargetExecutor = /*#__PURE__*/function () {
324
341
  var targetValue = tmodel.targetValues[key] || TargetUtil.emptyValue();
325
342
  tmodel.targetValues[key] = targetValue;
326
343
  var easing = TUtil.isDefined(newEasing) ? newEasing : TUtil.isDefined(tmodel.targets[key].easing) ? tmodel.targets[key].easing : undefined;
344
+ var specialTarget;
327
345
  if (TargetParser.isIntervalTarget(newValue)) {
328
346
  TargetExecutor.assignSingleTarget(targetValue, undefined, targetInitial, 0, 2, newValue.interval, easing);
347
+ } else if (specialTarget = tmodel.handleSpecialTarget(key, newValue, {
348
+ steps: newSteps,
349
+ cycles: newCycles,
350
+ interval: newInterval,
351
+ easing: easing
352
+ })) {
353
+ var _options$steps, _options$cycles, _options$interval, _options$easing;
354
+ var options = specialTarget === true ? {} : specialTarget;
355
+ TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, (_options$steps = options.steps) !== null && _options$steps !== void 0 ? _options$steps : newSteps, (_options$cycles = options.cycles) !== null && _options$cycles !== void 0 ? _options$cycles : newCycles, (_options$interval = options.interval) !== null && _options$interval !== void 0 ? _options$interval : newInterval, (_options$easing = options.easing) !== null && _options$easing !== void 0 ? _options$easing : easing);
329
356
  } else if (TargetParser.isChildTarget(key, newValue)) {
330
357
  tmodel.addChild(newValue);
331
358
  TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
332
359
  } else if (TargetParser.isChildrenTarget(key, newValue)) {
333
- var values = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
334
- values.forEach(function (child) {
360
+ var _options$steps2, _options$cycles2, _options$interval2, _options$easing2;
361
+ var _values = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
362
+ _values.forEach(function (child) {
363
+ var addedChildrenCount = tmodel.addedChildren.length;
335
364
  tmodel.addChild(child);
336
- TargetUtil.markAddChild(tmodel, TargetUtil.currentTargetName, tmodel.addedChildren[tmodel.addedChildren.length - 1].child);
365
+ if (tmodel.addedChildren.length > addedChildrenCount) {
366
+ var addedChild = tmodel.addedChildren[tmodel.addedChildren.length - 1].child;
367
+ TargetUtil.markAddChild(tmodel, TargetUtil.currentTargetName, addedChild);
368
+ }
337
369
  });
338
- TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
370
+ var result = tmodel.finalizeChildrenTarget(key, {
371
+ steps: newSteps,
372
+ cycles: newCycles,
373
+ interval: newInterval,
374
+ easing: easing
375
+ });
376
+ var _options = result && _typeof(result) === "object" ? result : {};
377
+ TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, (_options$steps2 = _options.steps) !== null && _options$steps2 !== void 0 ? _options$steps2 : 0, (_options$cycles2 = _options.cycles) !== null && _options$cycles2 !== void 0 ? _options$cycles2 : newCycles, (_options$interval2 = _options.interval) !== null && _options$interval2 !== void 0 ? _options$interval2 : newInterval, (_options$easing2 = _options.easing) !== null && _options$easing2 !== void 0 ? _options$easing2 : easing);
339
378
  } else if (TargetParser.isChildObjectTarget(key, tmodel.targets[key])) {
340
- var child = new TModel(key, tmodel.targets[key]);
379
+ var child = TargetExecutor.createTModel(key, tmodel.targets[key]);
341
380
  tmodel.addChild(child);
342
381
  var filteredValue = Object.fromEntries(Object.entries(newValue).filter(function (_ref) {
343
382
  var _ref2 = _slicedToArray(_ref, 1),
@@ -365,6 +404,13 @@ var TargetExecutor = /*#__PURE__*/function () {
365
404
  TargetExecutor.assignSingleTarget(targetValue, newValue, targetInitial, newSteps, newCycles, newInterval, easing);
366
405
  }
367
406
  }
407
+ }, {
408
+ key: "createTModel",
409
+ value: function createTModel(key, targets) {
410
+ return TModelFactory.create(key, targets, function (type, targets) {
411
+ return new TModel(type, targets);
412
+ });
413
+ }
368
414
  }]);
369
415
  }();
370
416
  export { TargetExecutor };
@@ -99,7 +99,7 @@ var TargetManager = /*#__PURE__*/function () {
99
99
  }
100
100
  schedulePeriod = ScheduleUtil.scheduleExecution(tmodel, key);
101
101
  if (schedulePeriod > 0) {
102
- getRunScheduler().schedule(schedulePeriod, "setActualValues-".concat(tmodel.oid));
102
+ getRunScheduler().schedule(schedulePeriod, "setActualValues-".concat(tmodel.oid, "-").concat(key));
103
103
  } else {
104
104
  tmodel.resetScheduleTimeStamp(key);
105
105
  this.setActualValue(tmodel, key);
@@ -161,7 +161,8 @@ var TargetManager = /*#__PURE__*/function () {
161
161
  }
162
162
  }
163
163
  } else {
164
- needsRefire = TUtil.handleValueChange(tmodel, key);
164
+ needsRefire = tmodel.handleSpecialTargetStep(key, step, steps) || needsRefire;
165
+ needsRefire = TUtil.handleValueChange(tmodel, key) || needsRefire;
165
166
  if (target !== null && target !== void 0 && target.activateNextTarget && !target.activateNextTarget.endsWith('$$') && target.activateNextTarget.endsWith('$')) {
166
167
  needsRefire = true;
167
168
  TargetUtil.shouldActivateNextTarget(tmodel, key);
@@ -188,6 +189,7 @@ var TargetManager = /*#__PURE__*/function () {
188
189
  }
189
190
  var newStatus = this.calculateTargetStatus(tmodel, key);
190
191
  tmodel.setTargetStatus(key, newStatus);
192
+ tmodel.handleSpecialTargetEnd(key);
191
193
  if (tmodel.isTargetImperative(key)) {
192
194
  var capKey = TargetUtil.getTargetName(TUtil.capitalizeFirstLetter(key));
193
195
  if (originalTarget && typeof originalTarget["on".concat(capKey, "End")] === "function") {
@@ -371,6 +373,7 @@ var TargetManager = /*#__PURE__*/function () {
371
373
  key: "animateActualValue",
372
374
  value: function animateActualValue(tmodel, key, targetValue, state, step, valuePointer) {
373
375
  if (!tmodel.hasDom()) {
376
+ tmodel.addToNoDomUpdatingTargets(key);
374
377
  return;
375
378
  }
376
379
  var newValue = step > 0 ? TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps) : state.initialValue;
@@ -98,7 +98,23 @@ var TargetParser = /*#__PURE__*/function () {
98
98
  if (!value || _typeof(value) !== 'object' || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) {
99
99
  return false;
100
100
  }
101
- return Object.prototype.hasOwnProperty.call(value, 'value') || Object.prototype.hasOwnProperty.call(value, 'steps') || Object.prototype.hasOwnProperty.call(value, 'interval') || Object.prototype.hasOwnProperty.call(value, 'easing') || Object.prototype.hasOwnProperty.call(value, 'cycles');
101
+ return Object.prototype.hasOwnProperty.call(value, 'value') || Object.prototype.hasOwnProperty.call(value, 'steps') || Object.prototype.hasOwnProperty.call(value, 'interval') || Object.prototype.hasOwnProperty.call(value, 'easing') || Object.prototype.hasOwnProperty.call(value, 'cycles') || Object.prototype.hasOwnProperty.call(value, 'instances');
102
+ }
103
+ }, {
104
+ key: "getTargetInstances",
105
+ value: function getTargetInstances(tmodel, key) {
106
+ var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
107
+ var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
108
+ if (!target || _typeof(target) !== 'object' || !TUtil.isDefined(target.instances)) {
109
+ return 1;
110
+ }
111
+ var instances = typeof target.instances === 'function' ? target.instances.call(tmodel, cycle) : target.instances;
112
+ return Math.max(1, Math.floor(Number(instances) || 1));
113
+ }
114
+ }, {
115
+ key: "getInstanceTargetValue",
116
+ value: function getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance) {
117
+ return TUtil.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
102
118
  }
103
119
  }, {
104
120
  key: "isChildrenTarget",
@@ -215,6 +231,7 @@ var TargetParser = /*#__PURE__*/function () {
215
231
  value: function getValueStepsCycles(tmodel, key) {
216
232
  var _target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
217
233
  var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
234
+ var instance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
218
235
  var valueOnly = _target && _target.valueOnly;
219
236
  var lastValue = tmodel.val(key);
220
237
  var value = null,
@@ -256,7 +273,7 @@ var TargetParser = /*#__PURE__*/function () {
256
273
 
257
274
  // Plain objects: compute value + params (steps/interval/easing/cycles)
258
275
  if (_typeof(target) === "object" && target !== null && Object.getPrototypeOf(target) === Object.prototype) {
259
- var valueResult = TUtil.runTargetValue(tmodel, target, key, cycle, lastValue);
276
+ var valueResult = TUtil.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
260
277
  if (TargetParser.isPrimitiveArray(valueResult) && (TUtil.isDefined(target.steps) || TUtil.isDefined(target.interval) || TUtil.isDefined(target.easing) || TUtil.isDefined(target.cycles))) {
261
278
  value = {
262
279
  list: valueResult