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.
@@ -147,8 +147,8 @@ var TModelUtil = /*#__PURE__*/function () {
147
147
  };
148
148
  }
149
149
  }, {
150
- key: "restoreDomState",
151
- value: function restoreDomState($root, domState) {
150
+ key: "restoreMountedDom",
151
+ value: function restoreMountedDom($root, domState) {
152
152
  if (!($root !== null && $root !== void 0 && $root.getElement()) || !domState) {
153
153
  return;
154
154
  }
@@ -157,22 +157,25 @@ var TModelUtil = /*#__PURE__*/function () {
157
157
  _step;
158
158
  try {
159
159
  var _loop = function _loop() {
160
+ var _element$tagName2;
160
161
  var state = _step.value;
161
162
  var element = elements[state.index];
162
163
  if (!element) {
163
164
  return 1; // continue
164
165
  }
165
- if (state.kind === "input") {
166
+ var tagName = (_element$tagName2 = element.tagName) === null || _element$tagName2 === void 0 ? void 0 : _element$tagName2.toLowerCase();
167
+ if (state.kind === "input" && tagName === "input") {
166
168
  element.value = state.value;
167
169
  element.checked = state.checked;
168
170
  element.indeterminate = state.indeterminate;
169
- } else if (state.kind === "textarea") {
171
+ } else if (state.kind === "textarea" && tagName === "textarea") {
170
172
  element.value = state.value;
171
- } else if (state.kind === "select") {
172
- _toConsumableArray(element.options).forEach(function (option, index) {
173
- option.selected = state.selected[index] === true;
173
+ } else if (state.kind === "select" && tagName === "select") {
174
+ Array.from(element.options).forEach(function (option, index) {
175
+ var _state$selected;
176
+ option.selected = ((_state$selected = state.selected) === null || _state$selected === void 0 ? void 0 : _state$selected[index]) === true;
174
177
  });
175
- } else if (state.kind === "details") {
178
+ } else if (state.kind === "details" && tagName === "details") {
176
179
  element.open = state.open;
177
180
  }
178
181
  };
package/build/TUtil.js CHANGED
@@ -11,9 +11,8 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
11
11
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
13
13
  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); }
14
- import { getLocationManager, tRoot, getEvents } from "./App.js";
14
+ import { getLocationManager, tRoot } from "./App.js";
15
15
  import { TargetUtil } from "./TargetUtil.js";
16
- import { TargetData } from "./TargetData.js";
17
16
  import { TModel } from "./TModel.js";
18
17
 
19
18
  /**
@@ -99,6 +98,11 @@ var TUtil = /*#__PURE__*/function () {
99
98
  value: function isDefined(obj) {
100
99
  return typeof obj !== "undefined" && obj !== null;
101
100
  }
101
+ }, {
102
+ key: "hasProperty",
103
+ value: function hasProperty(obj, key) {
104
+ return Object.prototype.hasOwnProperty.call(obj, key);
105
+ }
102
106
  }, {
103
107
  key: "isNumber",
104
108
  value: function isNumber(num) {
@@ -234,19 +238,6 @@ var TUtil = /*#__PURE__*/function () {
234
238
  }
235
239
  return false;
236
240
  }
237
- }, {
238
- key: "runTargetValue",
239
- value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
240
- var cleanKey = TargetUtil.getTargetName(key);
241
- var isExternalEvent = TargetData.allEventMap[cleanKey];
242
- if (isExternalEvent) {
243
- return typeof target.value === 'function' ? target.value.call(tmodel, getEvents().getCurrentOriginalEvent(), cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
244
- } 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;
246
- } else {
247
- return typeof target.value === 'function' ? target.value.call(tmodel, cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
248
- }
249
- }
250
241
  }, {
251
242
  key: "mergeTargets",
252
243
  value: function mergeTargets(tmodel1, tmodel2) {
@@ -321,7 +312,7 @@ var TUtil = /*#__PURE__*/function () {
321
312
  }, {
322
313
  key: "advanceTargetByElapsed",
323
314
  value: function advanceTargetByElapsed(tmodel, key) {
324
- var _targetValue$valueLis2;
315
+ var _targetValue$valueLis3;
325
316
  var targetValue = tmodel.targetValues[key];
326
317
  if (!targetValue) {
327
318
  return {
@@ -331,21 +322,24 @@ var TUtil = /*#__PURE__*/function () {
331
322
  done: false
332
323
  };
333
324
  }
334
- if (!targetValue.catchupAt) {
335
- var _targetValue$valueLis;
325
+ if (!TUtil.isDefined(targetValue.catchupAt)) {
326
+ var _targetValue$valueLis, _targetValue$valueLis2;
327
+ var step = tmodel.getTargetStep(key);
328
+ var valuePointer = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? tmodel.getValueListPointer(key) : 0;
336
329
  return {
337
- step: tmodel.getTargetStep(key),
330
+ step: step,
338
331
  cycle: tmodel.getTargetCycle(key),
339
- valuePointer: (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? tmodel.getValueListPointer(key) : 0,
340
- done: tmodel.getTargetStep(key) >= tmodel.getTargetSteps(key)
332
+ valuePointer: valuePointer,
333
+ done: (_targetValue$valueLis2 = targetValue.valueList) !== null && _targetValue$valueLis2 !== void 0 && _targetValue$valueLis2.length ? valuePointer >= targetValue.valueList.length : false
341
334
  };
342
335
  }
343
- var elapsedMs = TUtil.now() - targetValue.catchupAt;
344
- if ((_targetValue$valueLis2 = targetValue.valueList) !== null && _targetValue$valueLis2 !== void 0 && _targetValue$valueLis2.length) {
345
- return TUtil.advanceValueListTargetByElapsed(tmodel, key, elapsedMs);
346
- } else {
347
- return TUtil.advanceSimpleTargetByElapsed(tmodel, key, elapsedMs);
336
+ var now = TUtil.now();
337
+ var elapsedMs = now - targetValue.catchupAt;
338
+ var progress = (_targetValue$valueLis3 = targetValue.valueList) !== null && _targetValue$valueLis3 !== void 0 && _targetValue$valueLis3.length ? TUtil.advanceValueListTargetByElapsed(tmodel, key, elapsedMs) : TUtil.advanceSimpleTargetByElapsed(tmodel, key, elapsedMs);
339
+ if (!progress.done) {
340
+ targetValue.catchupAt = now - progress.remainingMs;
348
341
  }
342
+ return progress;
349
343
  }
350
344
  }, {
351
345
  key: "advanceSimpleTargetByElapsed",
@@ -355,15 +349,16 @@ var TUtil = /*#__PURE__*/function () {
355
349
  var cycles = tmodel.getTargetCycles(key);
356
350
  var step = tmodel.getTargetStep(key);
357
351
  var cycle = tmodel.getTargetCycle(key);
352
+ var remainingMs = elapsedMs;
358
353
  if (steps <= 0) {
359
354
  return {
360
355
  step: steps,
361
356
  valuePointer: 0,
362
357
  cycle: cycles,
363
- done: true
358
+ done: true,
359
+ remainingMs: 0
364
360
  };
365
361
  }
366
- var remainingMs = elapsedMs;
367
362
  while (remainingMs > 0 && cycle < cycles) {
368
363
  var remainingSteps = Math.max(steps - step, 0);
369
364
  var remainingSegmentMs = remainingSteps * interval;
@@ -375,7 +370,8 @@ var TUtil = /*#__PURE__*/function () {
375
370
  step: steps,
376
371
  valuePointer: 0,
377
372
  cycle: cycles,
378
- done: true
373
+ done: true,
374
+ remainingMs: remainingMs
379
375
  };
380
376
  }
381
377
  step = 0;
@@ -383,12 +379,14 @@ var TUtil = /*#__PURE__*/function () {
383
379
  }
384
380
  var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
385
381
  step += advancedSteps;
382
+ remainingMs -= advancedSteps * interval;
386
383
  return {
387
384
  step: step,
388
385
  steps: steps,
389
386
  valuePointer: 0,
390
387
  cycle: cycle,
391
- done: false
388
+ done: false,
389
+ remainingMs: remainingMs
392
390
  };
393
391
  }
394
392
  return {
@@ -396,7 +394,8 @@ var TUtil = /*#__PURE__*/function () {
396
394
  steps: steps,
397
395
  valuePointer: 0,
398
396
  cycle: cycle,
399
- done: cycle >= cycles
397
+ done: cycle >= cycles,
398
+ remainingMs: remainingMs
400
399
  };
401
400
  }
402
401
  }, {
@@ -411,7 +410,7 @@ var TUtil = /*#__PURE__*/function () {
411
410
  var valuePointer = tmodel.getValueListPointer(key);
412
411
  var step = tmodel.getTargetStep(key);
413
412
  var remainingMs = elapsedMs;
414
- while (remainingMs > 0 && cycle < cycles) {
413
+ while (cycle < cycles) {
415
414
  while (remainingMs > 0 && valuePointer < valueList.length) {
416
415
  var segmentSteps = stepList[(valuePointer - 1) % stepList.length];
417
416
  var interval = intervalList[(valuePointer - 1) % intervalList.length] || 8;
@@ -426,29 +425,39 @@ var TUtil = /*#__PURE__*/function () {
426
425
  }
427
426
  var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
428
427
  step += advancedSteps;
428
+ remainingMs -= advancedSteps * interval;
429
429
  return {
430
430
  step: step,
431
431
  steps: segmentSteps,
432
432
  valuePointer: valuePointer,
433
433
  cycle: cycle,
434
- done: false
434
+ done: false,
435
+ remainingMs: remainingMs
435
436
  };
436
437
  }
437
- cycle++;
438
- if (cycle >= cycles) {
439
- var finalPointer = valueList.length;
440
- var finalStepIndex = Math.max(0, valueList.length - 2);
441
- var finalSteps = stepList[finalStepIndex % stepList.length];
442
- return {
443
- step: finalSteps,
444
- steps: finalSteps,
445
- valuePointer: finalPointer,
446
- cycle: cycles,
447
- done: true
448
- };
438
+ if (valuePointer >= valueList.length) {
439
+ cycle++;
440
+ if (cycle >= cycles) {
441
+ var finalPointer = valueList.length;
442
+ var finalStepIndex = Math.max(0, valueList.length - 2);
443
+ var finalSteps = stepList[finalStepIndex % stepList.length];
444
+ return {
445
+ step: finalSteps,
446
+ steps: finalSteps,
447
+ valuePointer: finalPointer,
448
+ cycle: cycles,
449
+ done: true,
450
+ remainingMs: remainingMs
451
+ };
452
+ }
453
+ valuePointer = 1;
454
+ step = 0;
455
+ if (remainingMs <= 0) {
456
+ break;
457
+ }
458
+ continue;
449
459
  }
450
- valuePointer = 1;
451
- step = 0;
460
+ break;
452
461
  }
453
462
  var currentSteps = stepList[(valuePointer - 1) % stepList.length];
454
463
  return {
@@ -456,6 +465,7 @@ var TUtil = /*#__PURE__*/function () {
456
465
  steps: currentSteps,
457
466
  valuePointer: valuePointer,
458
467
  cycle: cycle,
468
+ remainingMs: remainingMs,
459
469
  done: cycle >= cycles
460
470
  };
461
471
  }
@@ -68,6 +68,12 @@ var TargetData = /*#__PURE__*/function () {
68
68
  value: function isTransformKey(key) {
69
69
  return !!TargetData.transformMap[key];
70
70
  }
71
+ }, {
72
+ key: "affectsVisibility",
73
+ value: function affectsVisibility(key) {
74
+ key = TargetUtil.getTargetName(key);
75
+ return ["x", "y", "width", "height", "dim"].includes(TargetUtil.getTargetName(key));
76
+ }
71
77
  }]);
72
78
  }();
73
79
  _TargetData = TargetData;
@@ -923,6 +929,6 @@ _defineProperty(TargetData, "lifecyclePatterns", {
923
929
  });
924
930
  _defineProperty(TargetData, "eventSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)))));
925
931
  _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'])));
932
+ _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
933
  _defineProperty(TargetData, "activationKeywordSet", new Set(['originalTModel', 'originalTargetName', 'activateNextTarget']));
928
934
  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.
@@ -159,8 +160,12 @@ var TargetExecutor = /*#__PURE__*/function () {
159
160
  TargetExecutor.assignSingleTarget(targetValue, value, undefined, steps, cycles, interval, easing);
160
161
  }
161
162
  if (targetValue) {
163
+ var _tmodel$noDomUpdating;
162
164
  TargetExecutor.resetImperativeProgress(targetValue);
163
165
  TargetExecutor.assignTargetOptions(targetValue, options);
166
+ if (targetValue.steps > 0 && (_tmodel$noDomUpdating = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating !== void 0 && _tmodel$noDomUpdating.has(key)) {
167
+ targetValue.catchupAt = TUtil.now();
168
+ }
164
169
  TargetExecutor.updateTarget(tmodel, targetValue, key, true, snapUpdates);
165
170
  if (tmodel.isTargetDone(key)) {
166
171
  TargetUtil.shouldActivateNextTarget(tmodel, key);
@@ -251,7 +256,7 @@ var TargetExecutor = /*#__PURE__*/function () {
251
256
  }, {
252
257
  key: "snapActualToTarget",
253
258
  value: function snapActualToTarget(tmodel, key, snapUpdates) {
254
- var _tmodel$animatingMap2;
259
+ var _tmodel$animatingMap$, _tmodel$animatingMap2;
255
260
  var targetValue = tmodel.targetValues[key];
256
261
  var newValue;
257
262
  if (Array.isArray(targetValue.valueList)) {
@@ -263,7 +268,11 @@ var TargetExecutor = /*#__PURE__*/function () {
263
268
  newValue = typeof value === 'function' ? value.call(tmodel) : value;
264
269
  }
265
270
  var valueChanged = tmodel.val(key) !== newValue;
266
- var isAnimating = (_tmodel$animatingMap2 = tmodel.animatingMap) === null || _tmodel$animatingMap2 === void 0 ? void 0 : _tmodel$animatingMap2.has(key);
271
+ var cleanKey = TargetUtil.getTargetName(key);
272
+ var animatedKey = _toConsumableArray((_tmodel$animatingMap$ = (_tmodel$animatingMap2 = tmodel.animatingMap) === null || _tmodel$animatingMap2 === void 0 ? void 0 : _tmodel$animatingMap2.keys()) !== null && _tmodel$animatingMap$ !== void 0 ? _tmodel$animatingMap$ : []).find(function (animatedKey) {
273
+ return TargetUtil.getTargetName(animatedKey) === cleanKey;
274
+ });
275
+ var isAnimating = !!animatedKey;
267
276
  if (!valueChanged && !isAnimating) {
268
277
  return;
269
278
  }
@@ -272,7 +281,7 @@ var TargetExecutor = /*#__PURE__*/function () {
272
281
  tmodel.setActual(key, newValue);
273
282
  TUtil.handleValueChange(tmodel, key);
274
283
  }
275
- if (!tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
284
+ if (!isAnimating || !tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
276
285
  targetValue.snapAnimation = false;
277
286
  return;
278
287
  }
@@ -315,7 +324,23 @@ var TargetExecutor = /*#__PURE__*/function () {
315
324
  return;
316
325
  }
317
326
  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);
327
+ var target = tmodel.targets[key];
328
+ var hasInstances = target && _typeof(target) === 'object' && TUtil.isDefined(target.instances);
329
+ var instances = hasInstances ? TargetParser.getTargetInstances(tmodel, key, target, cycle) : 1;
330
+ var valueArray;
331
+ if (hasInstances) {
332
+ var values = new Array(instances);
333
+ valueArray = TargetParser.getValueStepsCycles(tmodel, key, target, cycle, 0);
334
+ values[0] = valueArray[0];
335
+ valueArray[0] = values;
336
+ var lastValues = tmodel.val(key);
337
+ for (var instance = 1; instance < instances; instance++) {
338
+ var lastValue = Array.isArray(lastValues) ? lastValues[instance] : lastValues;
339
+ values[instance] = TargetParser.getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance);
340
+ }
341
+ } else {
342
+ valueArray = TargetParser.getValueStepsCycles(tmodel, key, target, cycle);
343
+ }
319
344
  var newValue = valueArray[0];
320
345
  var newSteps = valueArray[1] || 0;
321
346
  var newInterval = valueArray[2] || 0;
@@ -324,20 +349,42 @@ var TargetExecutor = /*#__PURE__*/function () {
324
349
  var targetValue = tmodel.targetValues[key] || TargetUtil.emptyValue();
325
350
  tmodel.targetValues[key] = targetValue;
326
351
  var easing = TUtil.isDefined(newEasing) ? newEasing : TUtil.isDefined(tmodel.targets[key].easing) ? tmodel.targets[key].easing : undefined;
352
+ var specialTarget;
327
353
  if (TargetParser.isIntervalTarget(newValue)) {
328
354
  TargetExecutor.assignSingleTarget(targetValue, undefined, targetInitial, 0, 2, newValue.interval, easing);
355
+ } else if (specialTarget = tmodel.handleSpecialTarget(key, newValue, {
356
+ steps: newSteps,
357
+ cycles: newCycles,
358
+ interval: newInterval,
359
+ easing: easing
360
+ })) {
361
+ var _options$steps, _options$cycles, _options$interval, _options$easing;
362
+ var options = specialTarget === true ? {} : specialTarget;
363
+ 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
364
  } else if (TargetParser.isChildTarget(key, newValue)) {
330
365
  tmodel.addChild(newValue);
331
366
  TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
332
367
  } else if (TargetParser.isChildrenTarget(key, newValue)) {
333
- var values = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
334
- values.forEach(function (child) {
368
+ var _options$steps2, _options$cycles2, _options$interval2, _options$easing2;
369
+ var _values = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
370
+ _values.forEach(function (child) {
371
+ var addedChildrenCount = tmodel.addedChildren.length;
335
372
  tmodel.addChild(child);
336
- TargetUtil.markAddChild(tmodel, TargetUtil.currentTargetName, tmodel.addedChildren[tmodel.addedChildren.length - 1].child);
373
+ if (tmodel.addedChildren.length > addedChildrenCount) {
374
+ var addedChild = tmodel.addedChildren[tmodel.addedChildren.length - 1].child;
375
+ TargetUtil.markAddChild(tmodel, TargetUtil.currentTargetName, addedChild);
376
+ }
337
377
  });
338
- TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
378
+ var result = tmodel.finalizeChildrenTarget(key, {
379
+ steps: newSteps,
380
+ cycles: newCycles,
381
+ interval: newInterval,
382
+ easing: easing
383
+ });
384
+ var _options = result && _typeof(result) === "object" ? result : {};
385
+ 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
386
  } else if (TargetParser.isChildObjectTarget(key, tmodel.targets[key])) {
340
- var child = new TModel(key, tmodel.targets[key]);
387
+ var child = TargetExecutor.createTModel(key, tmodel.targets[key]);
341
388
  tmodel.addChild(child);
342
389
  var filteredValue = Object.fromEntries(Object.entries(newValue).filter(function (_ref) {
343
390
  var _ref2 = _slicedToArray(_ref, 1),
@@ -365,6 +412,13 @@ var TargetExecutor = /*#__PURE__*/function () {
365
412
  TargetExecutor.assignSingleTarget(targetValue, newValue, targetInitial, newSteps, newCycles, newInterval, easing);
366
413
  }
367
414
  }
415
+ }, {
416
+ key: "createTModel",
417
+ value: function createTModel(key, targets) {
418
+ return TModelFactory.create(key, targets, function (type, targets) {
419
+ return new TModel(type, targets);
420
+ });
421
+ }
368
422
  }]);
369
423
  }();
370
424
  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") {
@@ -247,6 +249,7 @@ var TargetManager = /*#__PURE__*/function () {
247
249
  }, {
248
250
  key: "catchupTargetByElapsed",
249
251
  value: function catchupTargetByElapsed(tmodel, key) {
252
+ var _targetValue$valueLis4;
250
253
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
251
254
  _ref$fireEnd = _ref.fireEnd,
252
255
  fireEnd = _ref$fireEnd === void 0 ? false : _ref$fireEnd;
@@ -260,17 +263,16 @@ var TargetManager = /*#__PURE__*/function () {
260
263
  var step = progress.step;
261
264
  var valuePointer = progress.valuePointer;
262
265
  var cycle = progress.cycle;
263
- var theValue = tmodel.getTargetValue(key);
264
- var steps = tmodel.getTargetSteps(key);
265
266
  var cycles = tmodel.getTargetCycles(key);
266
267
  if (progress.done) {
267
- var _targetValue$valueLis, _targetValue$valueLis2, _targetValue$valueLis3;
268
- var finalValue = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? targetValue.valueList[targetValue.valueList.length - 1] : theValue;
268
+ var _targetValue$valueLis, _progress$steps, _targetValue$valueLis2, _targetValue$valueLis3;
269
+ var finalValue = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? targetValue.valueList[targetValue.valueList.length - 1] : tmodel.getTargetValue(key);
269
270
  tmodel.val(key, finalValue);
270
271
  tmodel.setActual(key, finalValue);
271
272
  tmodel.addToStyleTargetList(key);
272
- targetValue.step = steps;
273
+ targetValue.step = (_progress$steps = progress.steps) !== null && _progress$steps !== void 0 ? _progress$steps : tmodel.getTargetSteps(key);
273
274
  targetValue.valuePointer = (_targetValue$valueLis2 = (_targetValue$valueLis3 = targetValue.valueList) === null || _targetValue$valueLis3 === void 0 ? void 0 : _targetValue$valueLis3.length) !== null && _targetValue$valueLis2 !== void 0 ? _targetValue$valueLis2 : valuePointer;
275
+ targetValue.value = finalValue;
274
276
  targetValue.cycle = cycles;
275
277
  delete targetValue.catchupAt;
276
278
  if (fireEnd) {
@@ -278,11 +280,23 @@ var TargetManager = /*#__PURE__*/function () {
278
280
  }
279
281
  return {
280
282
  done: true,
281
- step: steps,
283
+ step: targetValue.step,
282
284
  cycle: cycles,
283
285
  valuePointer: targetValue.valuePointer
284
286
  };
285
287
  }
288
+ if ((_targetValue$valueLis4 = targetValue.valueList) !== null && _targetValue$valueLis4 !== void 0 && _targetValue$valueLis4.length) {
289
+ targetValue.valuePointer = valuePointer;
290
+ targetValue.initialValue = targetValue.valueList[valuePointer - 1];
291
+ targetValue.value = targetValue.valueList[valuePointer];
292
+ targetValue.steps = targetValue.stepList[(valuePointer - 1) % targetValue.stepList.length];
293
+ targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(valuePointer - 1) % targetValue.intervalList.length] : targetValue.interval;
294
+ targetValue.easing = targetValue.easingList[(valuePointer - 1) % targetValue.easingList.length];
295
+ }
296
+ targetValue.step = step;
297
+ targetValue.cycle = cycle;
298
+ var theValue = tmodel.getTargetValue(key);
299
+ var steps = tmodel.getTargetSteps(key);
286
300
  var initialValue = tmodel.getTargetInitialValue(key);
287
301
  if (!TUtil.isDefined(initialValue)) {
288
302
  initialValue = this.resolveInitialValue(tmodel, key, theValue);
@@ -292,9 +306,6 @@ var TargetManager = /*#__PURE__*/function () {
292
306
  tmodel.val(key, value);
293
307
  tmodel.setActual(key, value);
294
308
  tmodel.addToStyleTargetList(key);
295
- targetValue.step = step;
296
- targetValue.valuePointer = valuePointer;
297
- targetValue.cycle = cycle;
298
309
  return {
299
310
  done: false,
300
311
  step: step,
@@ -330,7 +341,7 @@ var TargetManager = /*#__PURE__*/function () {
330
341
  if (tmodel.canBeAnimated(state.cleanKey)) {
331
342
  this.animateActualValue(tmodel, key, targetValue, state, step, valuePointer);
332
343
  } else {
333
- this.updateActualValue(tmodel, key, targetValue, state, step, valuePointer);
344
+ this.updateActualValue(tmodel, key, targetValue, state, step);
334
345
  }
335
346
  }
336
347
  }, {
@@ -371,6 +382,7 @@ var TargetManager = /*#__PURE__*/function () {
371
382
  key: "animateActualValue",
372
383
  value: function animateActualValue(tmodel, key, targetValue, state, step, valuePointer) {
373
384
  if (!tmodel.hasDom()) {
385
+ tmodel.addToNoDomUpdatingTargets(key);
374
386
  return;
375
387
  }
376
388
  var newValue = step > 0 ? TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps) : state.initialValue;
@@ -382,7 +394,7 @@ var TargetManager = /*#__PURE__*/function () {
382
394
  }
383
395
  }, {
384
396
  key: "updateActualValue",
385
- value: function updateActualValue(tmodel, key, targetValue, state, step, valuePointer) {
397
+ value: function updateActualValue(tmodel, key, targetValue, state, step) {
386
398
  if (step <= state.steps) {
387
399
  tmodel.incrementTargetStep(key, state.now, state.lastUpdateTime, state.interval, state.steps);
388
400
  var newValue = TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps);
@@ -395,27 +407,31 @@ var TargetManager = /*#__PURE__*/function () {
395
407
  return;
396
408
  }
397
409
  }
398
- this.finishCurrentSegment(tmodel, key, targetValue, state, valuePointer);
410
+ this.finishCurrentSegment(tmodel, key, targetValue, state);
399
411
  }
400
412
  }, {
401
413
  key: "finishCurrentSegment",
402
- value: function finishCurrentSegment(tmodel, key, targetValue, state, valuePointer) {
414
+ value: function finishCurrentSegment(tmodel, key, targetValue, state) {
403
415
  tmodel.val(key, state.theValue);
404
416
  tmodel.setActual(key, state.theValue);
405
417
  tmodel.addToStyleTargetList(key);
406
418
  targetValue.step = state.steps;
407
419
  tmodel.setLastUpdate(key);
408
420
  var scheduleTime = 1;
409
- if (targetValue.valueList && valuePointer < targetValue.valueList.length) {
421
+ if (targetValue.valueList) {
410
422
  tmodel.incrementValueListPointer(key);
411
423
  var nextPointer = tmodel.getValueListPointer(key);
412
- tmodel.resetTargetStep(key);
413
- targetValue.initialValue = targetValue.value;
414
- targetValue.value = targetValue.valueList[nextPointer];
415
- targetValue.steps = targetValue.stepList[(nextPointer - 1) % targetValue.stepList.length];
416
- targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(nextPointer - 1) % targetValue.intervalList.length] : 0;
417
- targetValue.easing = targetValue.easingList[(nextPointer - 1) % targetValue.easingList.length];
418
- scheduleTime = state.interval;
424
+ if (nextPointer < targetValue.valueList.length) {
425
+ tmodel.resetTargetStep(key);
426
+ targetValue.initialValue = targetValue.value;
427
+ targetValue.value = targetValue.valueList[nextPointer];
428
+ targetValue.steps = targetValue.stepList[(nextPointer - 1) % targetValue.stepList.length];
429
+ targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(nextPointer - 1) % targetValue.intervalList.length] : 0;
430
+ targetValue.easing = targetValue.easingList[(nextPointer - 1) % targetValue.easingList.length];
431
+ scheduleTime = state.interval;
432
+ } else {
433
+ this.fireOnEnd(tmodel, key);
434
+ }
419
435
  } else {
420
436
  this.fireOnEnd(tmodel, key);
421
437
  }
@@ -9,6 +9,7 @@ import { TargetData } from './TargetData.js';
9
9
  import { TUtil } from './TUtil.js';
10
10
  import { TModel } from "./TModel.js";
11
11
  import { Easing } from "./Easing.js";
12
+ import { getEvents } from "./App.js";
12
13
 
13
14
  /**
14
15
  * It provides helper functions for classify target types
@@ -98,7 +99,41 @@ var TargetParser = /*#__PURE__*/function () {
98
99
  if (!value || _typeof(value) !== 'object' || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) {
99
100
  return false;
100
101
  }
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');
102
+ 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');
103
+ }
104
+ }, {
105
+ key: "getTargetInstances",
106
+ value: function getTargetInstances(tmodel, key) {
107
+ var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
108
+ var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
109
+ if (!target || _typeof(target) !== 'object' || !TUtil.isDefined(target.instances)) {
110
+ return 1;
111
+ }
112
+ var instances = typeof target.instances === 'function' ? target.instances.call(tmodel, cycle) : target.instances;
113
+ return Math.max(1, Math.floor(Number(instances) || 1));
114
+ }
115
+ }, {
116
+ key: "getInstanceTargetValue",
117
+ value: function getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance) {
118
+ return TargetParser.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
119
+ }
120
+ }, {
121
+ key: "runTargetValue",
122
+ value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
123
+ var instance = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
124
+ var cleanKey = TargetUtil.getTargetName(key);
125
+ var isExternalEvent = TargetData.allEventMap[cleanKey];
126
+ var instanceArgs = TUtil.isDefined(instance) ? [instance] : [];
127
+ if (isExternalEvent) {
128
+ var _target$value;
129
+ 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;
130
+ } else if (tmodel.val("___".concat(key))) {
131
+ var _target$value2;
132
+ 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;
133
+ } else {
134
+ var _target$value3;
135
+ 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;
136
+ }
102
137
  }
103
138
  }, {
104
139
  key: "isChildrenTarget",
@@ -215,6 +250,7 @@ var TargetParser = /*#__PURE__*/function () {
215
250
  value: function getValueStepsCycles(tmodel, key) {
216
251
  var _target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
217
252
  var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
253
+ var instance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
218
254
  var valueOnly = _target && _target.valueOnly;
219
255
  var lastValue = tmodel.val(key);
220
256
  var value = null,
@@ -256,7 +292,7 @@ var TargetParser = /*#__PURE__*/function () {
256
292
 
257
293
  // Plain objects: compute value + params (steps/interval/easing/cycles)
258
294
  if (_typeof(target) === "object" && target !== null && Object.getPrototypeOf(target) === Object.prototype) {
259
- var valueResult = TUtil.runTargetValue(tmodel, target, key, cycle, lastValue);
295
+ var valueResult = TargetParser.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
260
296
  if (TargetParser.isPrimitiveArray(valueResult) && (TUtil.isDefined(target.steps) || TUtil.isDefined(target.interval) || TUtil.isDefined(target.easing) || TUtil.isDefined(target.cycles))) {
261
297
  value = {
262
298
  list: valueResult